cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Role specific categories display in Back office product cockpit perspective

Former Member
0 Likes
1,555

Hi Experts,

I want to display Role specific categories in Back office product cockpit perspective .

Ex:If Grocery department role user login into the back office then only display the grocery related categories and products.please the below image instead of displaying the catalogs ,i need display role specific categories .

Accepted Solutions (1)

Accepted Solutions (1)

former_member1320010
Participant
0 Likes

Can you try this

1) Create a new class MyBackofficeFacetSearchStrategy extends DefaultFacetSearchStrategy , and in the search call add a condtion(FilterRawQuery) based on current user against the allowedUsers attribute that you will index below

2) Update the Backoffice index with allowedUsers attribute where you have a list of users which are allowed

Former Member
0 Likes

Thanks for reply ,I did the same :)

Answers (1)

Answers (1)

arvind-kumar_avinash
Active Contributor

Hi - you need to create a SearchRestriction e.g. I have imported the following ImpEx to create a SearchRestriction in order to limit a backoffice productcockpit user, TestProductManager to see only category 577 (Webcams) in electronicsProductCatalog. Instead of restricting a specific user, you can replace TestProductManager with the ID of a user group in this ImpEx .

 INSERT_UPDATE SearchRestriction;code[unique=true];generate;active;principal(uid);restrictedType(code);query
 ;my_category_restriction;TRUE;TRUE;TestProductManager;Category;{PK} IN ( {{SELECT {cat.PK} FROM {Category as cat JOIN Catalog as c ON {cat.catalog} = {c.PK}} WHERE {c.id} = 'electronicsProductCatalog' AND {cat.code} = '577'}})

arvind-kumar_avinash
Active Contributor
0 Likes

Hi - did it work for you?

Former Member
0 Likes

Thanks for reply.But its not worked reason is data is coming from solr not coming from database.

arvind-kumar_avinash
Active Contributor
0 Likes

You had not mentioned this requirement 🙂 but I am glad to see that you have already solved your problem.

Of course, the one which I have mentioned is applicable only when data is coming from the database.

A general note for the ones who are new to Hybris: Restrictions are rules obeyed by FlexibleSearch which allow limiting search results depending on which type is searched and which user is currently logged in.