User ^v2.7.0
Represents an individual user within the system, providing methods to manage their properties and groups.
Functions and Properties
isTwoFactorEnabled()
Checks if two-factor authentication is enabled for the user.
Returns:
true
if two-factor authentication is enabled, otherwisefalse
.
getRole()
Retrieves the role of the user within the system.
Returns:
- The name of the user's role, (eg. MODLLER, COLLABORATOR, ANALYST).
hasGroup(group)
Checks if the user is a member of a specific group.
hasAdminGroup()
Checks if the user is a part of the admin group.
Returns:
true
if the user is a member of the admin group, otherwisefalse
.
addGroup(group)
Adds the user to a specified group.
removeGroup(group)
Removes the user from a specified group.
hasGroup(name)
Checks if the user is a member of a specific group by name.
addGroup(name)
Adds the user to a specified group by name.
removeGroup(name)
Removes the user from a specified group by name.
clearGroups()
Clears all group memberships for the user.
Returns:
true
if all groups were successfully cleared, otherwisefalse
.
groups()
Lists all groups the user is a member of, including the primary group.
Returns:
- A object containing the information on the user's groups and primary group.
setPrimaryGroup(group)
Sets the primary group for the user.
setPrimaryGroup(name)
Sets the primary group for the user by name.
getModelAccessLevel(modelIdOrName)
Retrieves the access level of the user for a specific model.
getObjectAccessLevel(modelIdOrName, objectType, objectKey, breakOnAccessLevel)
Retrieves the effective access level of the user for a specific object within a model.
Parameters:
modelIdOrName
- Identifier or name of the model.objectType
- Type of the object within the model, such asCUBES
,CARDS
,WORKVIEWS
,DIMENSIONS
,PROCESSES
,SCHEDULES
,TABLES
,APPLICATIONS
,MAPPINGS
, orVARIABLES
.objectKey
- Identifier of the specific object.breakOnAccessLevel
- Optional access level to stop the check.
Returns:
- The effective access level name as a string.
getElementAccessLevel(modelIdOrName, dimensionIdOrName, elementName, breakOnAccessLevel)
Retrieves the access level of the user for a specific element within a model's dimension.
Examples
js
// Check if user is part of a specific group
var isUserInGroup = currentUser.hasGroup("Test Group");
console.log("Is User in Test Group? " + (isUserInGroup ? "Yes" : "No"));
// Add user to a new group
var addGroupSuccess = currentUser.addGroup("Example Group");
console.log("User added to Example Group: " + (addGroupSuccess ? "Successful" : "Failed"));
// Remove user from a group
var removeGroupSuccess = currentUser.removeGroup("Example Group");
console.log("User removed from Example Group: " + (removeGroupSuccess ? "Successful" : "Failed"));
// List all groups a user belongs to
var userGroups = currentUser.groups();
console.log("User Groups: ", userGroups);