Business roles and restricting access for widgets in Backoffice

Nuray Fahri
3 min readJan 10, 2021

In SAP Commerce(Hybris) Backoffice we can restrict access to the application to certain data, functionality and configuration settings. This means that we can design a Backoffice application that shows a different application mash-up to different business users, depending on their business role.

A Backoffice Role is an extension of UserGroup which is meant to be used for restricting access in Backoffice (i.e. UI configuration context defines an dimension called principal which actually work exactly on BackofficeRoles). We cannot use simple UserGroup — it will not be respected by Backoffice.

Here are the steps below for adding restriction:

Create custom backoffice extension

We create our own backoffice extension by using “ybackoffice” template and add this to our localextensions.xml. This backoffice webapplication contains new modules,widgets and UI components. By using custom backoffice extenstion we can create our own implementation.

  1. We create a UserGroup by selecting Backoffice Role:

Change backoffice login disabled to false in administration tab.

2. We create a new Employee or use an existing one and assign it the user group we created above.

3. To restrict access to specific tree node — (Product in our example) for the role in explorer tree we should add this in <ourextension>-backoffice-config.xml — in newly created extension(above).

In principal we define the role — “portaladminborole” in our example.

After login with the employee which we assigned the role we can see the result.

We can also want to restrict access to certain data types, we can do this in Backoffice Permission Management and give/remove “read”, “change”, “create”, “remove” access.

Customizing section for Product in backoffice

Let’s say we want to add new fields in the essentials and description sections of the Product’s editor area in the Backoffice. Here is how we can do this:

With <editArea:essenstialSections tag we can specify which fields to be displayed in “Essential” tab and with <editorArea:tab name”hmc.tab.product.properties” tag we specify the tab and with <editorArea:section name”hmc.tab.product.descriptions” tag we specify the section the field will be shown.

position” attribute is used to specify the position of the attribute in the section.

How we can add new field in Backoffice list view?

We can do it using <list-vie:list-view> tag again in <ourextension>-backoffice-config.xml.

More you can learn here:

https://help.sap.com/viewer/5c9ea0c629214e42b727bf08800d8dfa/1808/en-US/8b80155586691014b8a180a42610cdbc.html

https://help.sap.com/viewer/5c9ea0c629214e42b727bf08800d8dfa/6.7.0.0/en-US/8b6f8af58669101495a7aa8620585384.html

Make sure you give this post a clap and follow my blog if you find it helpful.

--

--