Restrict catalog item to admins (Make it available only to members of an assignment group)

Akshatha Balla1
Tera Contributor

Hi,

I have a requirement where I need to restrict the access to a catalog item even for an admin. Only the members of a group should be able to access it. I have tried this by putting the user criteria for the category of the catalog item to exclude admins (In Not available for), even tried this by restricting it at the catalog item level by excluding admin and including just that group but none seems to be working.

Is admin supposed to override any user criteria(even if excluded explicitly)? Looking for pointers on how the system is supposed to behave and if I am supposed to do something different.

Any help on this is appreciated.

Regards,

Akshatha

2 REPLIES 2

Community Alums
Not applicable

Hi,

Create a new User Criteria > Give it a meaningful name > Check "Advance",in script section add following code :

if(!user.hasRole("role_who_can_view_item"))
{
condition =false;//set visiility to false if user don't have "role_who_can_view_item" role
}

OR

Configure > Related Lists > Pull Not Available for / Not available for Group and configure it.

Also, double check whether the group from whom you are hiding the items have the correct role.

Mark my answer correct & Helpful, if Applicable.

Thanks,

Sandeep

Hi,

To use your script, I need to have the catalog item visibility according to the role. I just have the assignment group whose members should be able (irrespective of the role) to see it and the rest (including admins) should not see it.

How can I modify your code to accommodate that? And I tried the second option, does not seem to be working.