getGroupIds()

The method returns the group IDs.

Synopsis

public dyn_uint getGroupIds();

Return Value

The group IDs.

Errors

Errors are shown in the log viewer.

Use the function getGroupIds(); for a user user.getGroupIds() but not for groups. group.getGroupIds(). See also example below.

EXAMPLE

#uses "classes/userManagement/UserManagement"
main(mapping event)
{
  shared_ptr<UserManagement> um = UserManagement::getInstance();
  shared_ptr<UserManagementUser> user = um.getUserByName("para");
  // DEMO: Iterate through list of groups
  dyn_anytype groupInfos = um.getGroupsByUser(user);
  for (int i = 1; i <= dynlen(groupInfos); i++)
  {
    DebugN("Group of the user " + user.getName(), groupInfos[i].getName(), groupInfos[i].getId());
  }
  // DEMO: Get user's groups IDs
  DebugN("Group IDs", user.getGroupIds());
}

Assignment

User administration

See also