getGroups()

The method returns the group data for a user.

Synopsis

public dyn_anytype getGroups(anytype um);

Parameter Description
um An instance of the UserManagement class.

Return Value

The group data for the specified user.

Errors

Errors are shown in the log viewer.

EXAMPLE

#uses "classes/userManagement/UserManagement"
main()
{
  shared_ptr<UserManagement> m_um = UserManagement::getInstance();
  anytype area1 = new UserManagementArea("Area1");
  anytype area2 = new UserManagementArea("Area2");
  shared_ptr<UserManagementGroup> GroupData;
  m_um.addArea(area1);
  m_um.addArea(area2);
  m_um.saveChanges();
  /*Adds the group Group1 to the user management */
  anytype group = new UserManagementGroup("Group1");
  m_um.addGroup(group);
  anytype user = new UserManagementUser("JohnDoe");
  DebugN("Added user:", m_um.addUser(user)); /*Adds the user JohnDoe to the user management */
  DebugN("Save changes:",m_um.saveChanges());
  m_um.addGroupToUser(group, user);
  m_um.saveChanges();
  group.addArea(area1);
  group.addArea(area2);
  m_um.saveChanges();
  /*Returns the group data and the areas belonging to the group */
  DebugTN("Get group data:", user.getGroups(m_um));
  DebugTN("Get area names of the group group1:", group.getAreaNames(m_um));
}

Assignment

User administration

See also

getGroup(), getGroupsByAreaId(), getGroupsByUser()