getGroupsByUser()

The method returns groups for the specified user name.

Synopsis

public dyn_anytype getGroupsByUser(UserManagementUser user);

Parameter Description
user The user for whom the groups are returned.

Return Value

The groups for the specified user name.

Errors

Errors are shown in the log viewer.

EXAMPLE

#uses "classes/userManagement/UserManagement"
main(mapping event)
{
  shared_ptr<UserManagement> userMgm = UserManagement::getInstance();
  shared_ptr<UserManagementUser> usr;
  usr = userMgm.getUserByName("gast");
  dyn_anytype GroupInfo = userMgm.getGroupsByUser(usr); /* Returns the groups for the user "gast" */
  for (int i =1; i<= dynlen(GroupInfo); i++)
  DebugN("Groups of the user gast:", GroupInfo[i].getName());
}

Assignment

User administration

See also

getGroupByName(), getGroupByOSID(), getGroupsByAreaId()