getGroupNames()
The method returns the user groups of a user.
Synopsis
public dyn_string getGroupNames(anytype um);
Parameter | Description |
---|---|
um | An instance of the UserManagement class. |
Return Value
The user group names of a 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); /* Adds the user JohnDoe to the group Group1 */
m_um.saveChanges();
group.addArea(area1);
group.addArea(area2);
m_um.saveChanges();
/*Returns the groups and the areas */
DebugTN("Get group names:", user.getGroupNames(m_um));
DebugTN("Get area names of the group Group1:", group.getAreaNames(m_um));
}
Assignment
See also