User ^v2.7.0
Represents an individual user within the system, providing methods to manage their properties and groups.
This same user object is returned by userSecurity.users and by security.application(...).users.
Identity
getId()
Retrieves the unique identifier of the user.
Returns:
- The user's ID as an integer.
getName()
Retrieves the name of the user.
Returns:
- The user's name.
getEmail()
Retrieves the email address of the user.
Returns:
- The user's email address.
isTwoFactorEnabled()
Checks if two-factor authentication is enabled for the user.
Returns:
trueif 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:
trueif 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:
trueif 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.
Security Group Access
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);
Access Tag Security ^v2.7.212
hasTag(application, tagNameOrId)
Checks if the user has a specific tag within an application.
hasTag(tag)
Checks if the user has a specific tag object.
addTag(application, tagNameOrId)
Adds a tag to the user.
addTag(application, tag)
Adds a tag object to the user.
Parameters:
application- The application name or id.tag- The tag object.
Returns:
trueif the tag was successfully added, otherwisefalse.
removeTag(application, tagNameOrId)
Removes a tag from the user.
removeTag(application, tag)
Removes a tag object from the user.
Parameters:
application- The application name or id.tag- The tag object.
Returns:
trueif the tag was successfully removed, otherwisefalse.
clearTags(application)
Clears all tags for the user in the specified application.
setTags(application, tagNames)
Sets the user's tags using tag names.
setTags(application, tags)
Sets the user's tags using tag objects.
Parameters:
application- The application name or id.tags- An array of tag objects.
Returns:
trueif tags were successfully set, otherwisefalse.
tags(application)
Lists all tags assigned to the user for the application.
Parameters:
application- The application name or id.
Returns:
- An array of ElementTag and ScreenTag interfaces.
screenTags(application)
Lists all screen tags assigned to the user.
elementTags(application)
Lists all element tags assigned to the user.
Parameters:
application- The application name or id.
Returns:
- An array of ElementTag interfaces.
getElementAccessTagLevel(application, dimension, element)
Retrieves the effective access level from tags for a specific element.
getAvailableScreens(application)
Retrieves the screens available to the user based on tag access.
Parameters:
application- The application name or id.
Returns:
- A list of available ApplicationScreen objects or screen identifiers, depending on the application configuration.