我希望您已经拥有一个自定义后台扩展,如果没有,请按照本教程创建一个。
现在,在yourcustombackoffice-backoffice-config.xml中,您可以为您的 itemtype 声明listviewactions组件,其中包含您希望允许用户/组执行的操作。然后您需要将该用户的角色/组分配给主体属性。
例如,有两个后台角色“mainRole”和“otherRole”。“mainRole”角色已分配给 X 用户,“otherRole”角色已分配给 Y 用户。现在使用下面的后台配置,X 用户只能看到创建按钮,Y 用户只能看到删除按钮。
<contexttype="Media" component="listviewactions" principal="mainRole" module="hideActionB">
<y:actionsxmlns:y="http://www.hybris.com/cockpit/config/hybris"xmlns:advanced-search="http://www.hybris.com/cockpitng/config/advancedsearch"xmlns:df="http://www.hybris.com/cockpitng/component/dynamicForms"xmlns:editorArea="http://www.hybris.com/cockpitng/component/editorArea"xmlns:explorer-tree="http://www.hybris.com/cockpitng/config/explorertree"xmlns:list-view="http://www.hybris.com/cockpitng/component/listView"xmlns:simple-search="http://www.hybris.com/cockpitng/config/simplesearch"xmlns:wz="http://www.hybris.com/cockpitng/config/wizard-config"xmlns:ysl="http://www.hybris.com/cockpitng/config/simplelist">
<y:group qualifier="common">
<y:label>actiongroup.common</y:label>
<y:action action-id="com.hybris.cockpitng.action.create" property="pageable.typeCode"/>
</y:group>
</y:actions>
</context>
<contexttype="Media" component="listviewactions" principal="otherRole" module="hideActionB">
<y:actionsxmlns:y="http://www.hybris.com/cockpit/config/hybris"xmlns:advanced-search="http://www.hybris.com/cockpitng/config/advancedsearch"xmlns:df="http://www.hybris.com/cockpitng/component/dynamicForms"xmlns:editorArea="http://www.hybris.com/cockpitng/component/editorArea"xmlns:explorer-tree="http://www.hybris.com/cockpitng/config/explorertree"xmlns:list-view="http://www.hybris.com/cockpitng/component/listView"xmlns:simple-search="http://www.hybris.com/cockpitng/config/simplesearch"xmlns:wz="http://www.hybris.com/cockpitng/config/wizard-config"xmlns:ysl="http://www.hybris.com/cockpitng/config/simplelist">
<y:group qualifier="common">
<y:label>actiongroup.common</y:label>
<y:action action-id="com.hybris.cockpitng.action.delete" property="currentObject"/>
</y:group>
</y:actions>
</context>
</config>
在此处查找更详细的步骤