#hybris
#sap-commerce-cloud
Вопрос:
Как скрыть пользовательский атрибут в backoffice на основе ролей пользователей? Только пользователь с определенной ролью должен иметь возможность редактировать этот атрибут из backoffice. Для других он должен быть недоступен для редактирования.
Ответ №1:
Продублируйте конфигурацию контекста и добавьте principal
конфигурацию следующим образом:
Для всех пользователей будет применена следующая конфигурация :
<context type="Book" parent="GenericItem" merge-by="type">
<context component="editor-area">
<editorArea:editorArea>
<editorArea:tab name="hmc.tab.common" position="0">
<editorArea:section name="book.section.entities">
<editorArea:attribute qualifier="title"/>
</editorArea:editorArea>
</editorArea:tab>
</editorArea:editorArea>
</context>
</context>
Продублируйте эту конфигурацию и добавьте principal
свойство в контекст, которое будет настроено для конкретных пользователей, и добавьте readOnly
опцию к атрибуту :
<context type="Book" parent="GenericItem" merge-by="type" principal="SpecificUserRoleGroup">
<context component="editor-area">
<editorArea:editorArea>
<editorArea:tab name="hmc.tab.common" position="0">
<editorArea:section name="book.section.entities">
<editorArea:attribute qualifier="title" readonly="true"/>
</editorArea:editorArea>
</editorArea:tab>
</editorArea:editorArea>
</context>
</context>