Business roles and restricting access for widgets in Backoffice

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.

--

--

--

Software Development Lead @Coca-Cola HBC

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Reflecting business logic rules into the domain models using typescript — Part 1

Reflecting business logic rules into the domain models

Should we use static typing in JavaScript?

Switching from React JS to React Native!

useParams, how do you React?

HangFire - Delayed / Recurring Jobs

How to create your own libraries and link it to local use in Angular?

5 Useful Methods for Arrays in JavaScript

My Javascript Journey

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Nuray Fahri

Nuray Fahri

Software Development Lead @Coca-Cola HBC

More from Medium

Count the Number of Words in a Word Document Using Java

Concurrency- Chapter1- Atomic & Collections

Builder Design Pattern

Useless Java: Day 17