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);
Av: 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


Av: Michel Krohn-Dale 13. jun 2017