remove()
The method deletes an object such as a user or a group.
Synopsis
public bool remove(shared_ptr<UserManagementBaseType> object);
Parameter | Description |
---|---|
osId | The object that is deleted. |
Return Value
The method returns TRUE if an object could be deleted.
Errors
Errors are shown in the log viewer.
EXAMPLE
#uses "classes/userManagement/UserManagement"
main(mapping event)
{
mapping grData = makeMapping();
shared_ptr<UserManagement> userMgm = UserManagement::getInstance();
shared_ptr<UserManagementGroup> userGroup;
userGroup = userMgm.getGroupByName("operatorAll");
if (userGroup != nullptr)
{
DebugN("Remove group:", userMgm.remove(userGroup));
/* Deletes the group operatorAll */
userMgm.saveChanges();
}
else
DebugN("Group not found");
dyn_anytype allGroups = userMgm.getAllGroups();
for (int i =1; i<=dynlen(allGroups); i++)
{
DebugN("Groups:", allGroups[i].getName());
}
}
Assignment
See also