【问题标题】:How to hide the custom attribute in backoffice based on user roles?如何根据用户角色在后台隐藏自定义属性?
【发布时间】:2021-03-01 15:39:55
【问题描述】:

如何根据用户角色在后台隐藏自定义属性? 只有具有特定角色的用户才能从后台编辑该属性。对于其他人,它应该是不可编辑的。

【问题讨论】:

    标签: hybris


    【解决方案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>
    

    【讨论】:

      猜你喜欢
      • 2020-03-24
      • 2021-05-28
      • 2011-11-09
      • 2019-05-17
      • 2017-07-22
      • 1970-01-01
      • 2018-07-19
      • 2012-09-16
      • 2021-08-05
      相关资源
      最近更新 更多