access fixed within template

This commit is contained in:
anhefti 2020-03-31 14:41:40 +02:00
parent de8db15928
commit 3f57d63fba

View file

@ -161,7 +161,7 @@ public class ConfigTemplateForm implements TemplateComposer {
Domain.CONFIGURATION_NODE.ATTR_NAME, Domain.CONFIGURATION_NODE.ATTR_NAME,
FORM_NAME_TEXT_KEY, FORM_NAME_TEXT_KEY,
examConfig.name) examConfig.name)
.mandatory(!isReadonly)) .mandatory(!isReadonly))
.addField(FormBuilder.text( .addField(FormBuilder.text(
Domain.CONFIGURATION_NODE.ATTR_DESCRIPTION, Domain.CONFIGURATION_NODE.ATTR_DESCRIPTION,
FORM_DESCRIPTION_TEXT_KEY, FORM_DESCRIPTION_TEXT_KEY,
@ -227,10 +227,12 @@ public class ConfigTemplateForm implements TemplateComposer {
.withFilter(this.groupFilter) .withFilter(this.groupFilter)
.sortable() .sortable()
.widthProportion(1)) .widthProportion(1))
.withDefaultAction(pageActionBuilder .withDefaultActionIf(
.newAction(ActionDefinition.SEB_EXAM_CONFIG_TEMPLATE_ATTR_EDIT) () -> modifyGrant,
.withParentEntityKey(entityKey) () -> pageActionBuilder
.create()) .newAction(ActionDefinition.SEB_EXAM_CONFIG_TEMPLATE_ATTR_EDIT)
.withParentEntityKey(entityKey)
.create())
.withSelectionListener(this.pageService.getSelectionPublisher( .withSelectionListener(this.pageService.getSelectionPublisher(
pageContext, pageContext,
@ -249,7 +251,7 @@ public class ConfigTemplateForm implements TemplateComposer {
attrTable::getSelection, attrTable::getSelection,
PageAction::applySingleSelectionAsEntityKey, PageAction::applySingleSelectionAsEntityKey,
EMPTY_ATTRIBUTE_SELECTION_TEXT_KEY) EMPTY_ATTRIBUTE_SELECTION_TEXT_KEY)
.publishIf(attrTable::hasAnyContent, false) .publishIf(() -> attrTable.hasAnyContent() && modifyGrant, false)
.newAction(ActionDefinition.SEB_EXAM_CONFIG_TEMPLATE_ATTR_SET_DEFAULT) .newAction(ActionDefinition.SEB_EXAM_CONFIG_TEMPLATE_ATTR_SET_DEFAULT)
.withParentEntityKey(entityKey) .withParentEntityKey(entityKey)
@ -258,7 +260,7 @@ public class ConfigTemplateForm implements TemplateComposer {
action -> this.resetToDefaults(action, attrTable), action -> this.resetToDefaults(action, attrTable),
EMPTY_ATTRIBUTE_SELECTION_TEXT_KEY) EMPTY_ATTRIBUTE_SELECTION_TEXT_KEY)
.noEventPropagation() .noEventPropagation()
.publishIf(attrTable::hasAnyContent, false) .publishIf(() -> attrTable.hasAnyContent() && modifyGrant, false)
.newAction(ActionDefinition.SEB_EXAM_CONFIG_TEMPLATE_ATTR_LIST_REMOVE_VIEW) .newAction(ActionDefinition.SEB_EXAM_CONFIG_TEMPLATE_ATTR_LIST_REMOVE_VIEW)
.withParentEntityKey(entityKey) .withParentEntityKey(entityKey)
@ -267,7 +269,7 @@ public class ConfigTemplateForm implements TemplateComposer {
action -> this.removeFormView(action, attrTable), action -> this.removeFormView(action, attrTable),
EMPTY_ATTRIBUTE_SELECTION_TEXT_KEY) EMPTY_ATTRIBUTE_SELECTION_TEXT_KEY)
.noEventPropagation() .noEventPropagation()
.publishIf(attrTable::hasAnyContent, false) .publishIf(() -> attrTable.hasAnyContent() && modifyGrant, false)
.newAction(ActionDefinition.SEB_EXAM_CONFIG_TEMPLATE_ATTR_LIST_ATTACH_DEFAULT_VIEW) .newAction(ActionDefinition.SEB_EXAM_CONFIG_TEMPLATE_ATTR_LIST_ATTACH_DEFAULT_VIEW)
.withParentEntityKey(entityKey) .withParentEntityKey(entityKey)
@ -276,7 +278,7 @@ public class ConfigTemplateForm implements TemplateComposer {
action -> this.attachView(action, attrTable), action -> this.attachView(action, attrTable),
EMPTY_ATTRIBUTE_SELECTION_TEXT_KEY) EMPTY_ATTRIBUTE_SELECTION_TEXT_KEY)
.noEventPropagation() .noEventPropagation()
.publishIf(attrTable::hasAnyContent, false); .publishIf(() -> attrTable.hasAnyContent() && modifyGrant, false);
} }
pageActionBuilder pageActionBuilder