I added a new editorArea:section
in backoffice-config.xml
in Hybris like this:
<editorArea:section name="myEditorArea">
<editorArea:attribute qualifier="someQualifier"/>
</editorArea:section>
I would like to hide this in Backoffice for some specific Base stores, using the editorArea
name, using a Java handler. Is there a way to do this?
If you have a principal (i.e. an user group) defined for the specific base store, you can do the following.
Let's assume you have type Book and in backoffice-config.xml there is a context defined for the type as the following
<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:attribute qualifier="description"/>
</editorArea:editorArea>
</editorArea:tab>
</editorArea:editorArea>
</context>
</context>
With assumption there are no search restrictions and permissions allow to modify title and description properties, backoffice users will be able to modify them. Now let's assume the Book type has the isdn property and an editor area for this property in backoffice should visible only to backofficeadministratorrole and book.publishers.de usergroups. In its turn, the book.publishers.de is a German base store specific group and defined as the following
INSERT_UPDATE BackofficeRole; uid[unique = true]; locName[lang = en]; authorities; backOfficeLoginDisabled[default = false]
; book.publishers.de ; German Publishers ; book.publishers.de
As you can see the role is defined as BackofficeRole which is a child of UserGroup, but not as UserGroup directly. This is important.
Within the parent above context code snippet you should add one more context as the following in order to implement the assumed restriction above
<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:attribute qualifier="description"/>
</editorArea:editorArea>
</editorArea:tab>
</editorArea:editorArea>
</context>
<context component="editor-area" principal="backofficeadministratorrole,book.publishers.de" merge-by="principal">
<editorArea:editorArea>
<editorArea:tab name="hmc.addresses" merge-mode="append">
<editorArea:section name="hmc.tab.common">
<editorArea:attribute qualifier="isdn"/>
</editorArea:section>
</editorArea:tab>
</editorArea:editorArea>
</context>
</context>
When the change is deployed, do not forget to reset everything in backoffice (F4->Top right corner y icon -> Reset everything).