【发布时间】:2021-03-01 15:39:55
【问题描述】:
如何根据用户角色在后台隐藏自定义属性? 只有具有特定角色的用户才能从后台编辑该属性。对于其他人,它应该是不可编辑的。
【问题讨论】:
标签: hybris
如何根据用户角色在后台隐藏自定义属性? 只有具有特定角色的用户才能从后台编辑该属性。对于其他人,它应该是不可编辑的。
【问题讨论】:
标签: hybris
复制上下文配置并添加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>
【讨论】: