Coming soon: Your brand new Help Center & Community! Get a sneak-peek here

Menu access by user group

We have used a check against useraccess to controll access to custom menus in CS 7.5 and earlier

if (userAccess(getVariable("activeUser"), "admin")) { ... 

Is it possible to instead check for the users group or part of the group name? I am not vell versed in how the tablestructure for groups are handled after the change to 7.5.

RE: Menu access by user group

Hi Lorentz,

you can access the UserGroup table through the associate table: 

String userId = getVariable("activeUser");
String groupId;
String groupName;

SearchEngine seGroup;
seGroup.addCriteria("associate.ejuserId", "Equals", userId);
if( > 0)
  groupId = seGroup.getField(0);
  groupName = seGroup.getField(1);
Von: Simen Mostuen Iversen 13. Jun 2017

RE: Menu access by user group

This will only give you the primary usergroup. If you need to check all usergroups you need to search against UserGroupLink


Von: Michel Krohn-Dale 13. Jun 2017