This section describes the Role Vault API. It includes these sections:
The Role Vault API allows you to programmatically access role assignments. It includes a set of methods for reporting on role assignments by container, user, group, or role, and for determining whether a user is in a particular role. You might use this API in conjunction with the Role Request activity to write your own workflow that can:
Display the current role assignments for a particular user on a form.
Allow the user to request a new role assignment.
Verify whether the requested roles have any Separation of Duty (SoD) constraints then perform custom branching based on the existing SoD constraints. If the conflicts are allowed, you could invoke the Role Request activity to complete the assignment. Or, you can build in logic before allowing the user to make a role assignment request.
This section includes the following topics:
The Role Vault API is available from both forms and provisioning requests. The method signatures and return values are the same regardless of where they are used.You access the API by using the Expression Builder.
In a workflow, you can access the Role Vault API from an activity (such as the Role Request Activity) through the Vault Expressions panel of the Expression Builder.
From a form, you access the Role Script API by creating an event on the form and launching the Expression Builder from the event’s action expression property. The supported script expressions are available under the Vaults Node in the ECMAScript Variables panel.
Some methods take a locale as a parameter. If you do not specify a locale, the User Application uses:
The authenticated user’s preferred locale when run from a form.
The User Application’s default locale when run in a workflow.
The Role Vault methods run in the following security context:
On a form, the security context is that of the currently logged in user.
On a workflow, the security context is the LDAP administrator’s security context. Because this might return more data than an end user typically has access to, be careful how you display it.
The Role Script API methods typically return one of four Role Vault Beans objects (IdentityBeans, RoleAssignmentBeans, RoleBeans, and SodBeans), or one of four Role Vault Bean objects (IdentityBean, RoleAssignmentBean, RoleBean, and SodBean). A Bean object is a specific entry in the Role Subsystem, for example, IdentityBean can represent a specific user in the Identity Vault. A Beans object is a collection or array of Bean objects, for example, IdentityBeans might contain one or more user objects represented as individual Bean objects. You would iterate through the Beans extracting each Bean and working with it as a specific object. The Beans classes implement the Java Iterable interface, so they allow you to obtain member values directly out of the list of Bean objects as arrays.
This example shows how to use the Beans methods to return a list of member values for the Bean. The expression is used to address the Approval activity to all the user DNs that are assigned to the role. The components of this workflow and their responsibilities are summarized in Table 9-7, Sample Workflow for Roles.
Figure 9-3 Sample Workflow for Roles
Table 9-7 Sample Workflow for Roles
This example shows the methods to use to either array-like methods or a list iterator to walk through the individual RoleAssignmentBean objects contained in the RoleAssignmentBeans object. These methods are common to all of the Beans classes.
Figure 9-4 Sample Workflow for Retrieving SoDs
Table 9-8 Sample Workflow for Retrieving SoDs
The Role Script API includes the methods available in the ECMA expression builder. These are the methods available for forms and workflows. The methods are grouped for convenience as follows:
RoleVault.getContainersToRoleAssignments(roleDN)
Returns a RoleAssignmentBeans object that contains a list of RoleAssignmentBean objects. The RoleAssignmentBean objects include the container DN(s) assigned to the specified roleDN.
RoleVault.getGroupsToRoleAssignments(roleDN)
Returns a RoleAssignmentBeans object that contains a list of RoleAssignmentBean objects. The RoleAssignmentBean objects include the Group DNs assigned to the specified roleDN.
RoleVault.getRoleAssignmentCause(identityDn, roleDn)
Returns anIdentityBeans object that contains a list of IdentityBean objects. The IdentityBeans object shows the cause hierarchy for the role assignment for the specified identityDn and roleDn. For explicit assignments, it includes the DN of the user who made the request.
RoleVault.getRolesToContainerAssignments(containerDN)
Returns a RoleAssignmentBeans object that contains a list RoleAssignmentBean. The RoleAssignmentBean objects contain the role DN(s) assigned to the specified containerDN.
RoleVault.getRolesToGroupAssignments(groupDN)
Returns a RoleAssignmentBeans object that contains a list of RoleAssignmentBean objects. They include the role DNs for the specified groupDN.
RoleVault.getRolesToRoleAssignments(roleDN)
Returns a RoleAssignmentBeans object that contains a list of RoleAssignmentBean objects. The RoleAssignmentBean objects include the child role DNs assigned to the specified roleDN.
RoleVault.getRolesToUserAssignments(userDN)
Returns a RoleAssignmentBeans object that contains a list of RoleAssignmentBean objects. These beans include the role DN(s) assigned to the specified userDN.
RoleVault.getRolesUserIn(userDN)
Return a list of role DNs where the specified userDN is a member.
RoleVault.getSodViolations(sodDn)
Return a IdentityBeans object that contains a list of IdentityBean objects. They represent the users, groups, containers, and roles in violation of the specified sodDN.
RoleVault.getUsersInRole(roleDN)
Returns a list of user DNs who are members of the specified roleDn
RoleVault.getUsersToRoleAssignments(roleDN, direct)
Returns RoleAssignmentBeans object that contains a list of RoleAssignmentBean objects. The beans include the user DNs assigned to the specified roleDN. Specifying the direct argument means that only explicitly assigned to roles should be returned.
RoleVault.isUserAppAdmin(userDN)
Returns true if the current user is a Global Administrator.
RoleVault.isUserAttestationManager(userDN)
Returns true if the current user is an Attestation Officer.
RoleVault.isUserComplianceAdmin(userDN)
Returns true if the current user a Compliance Administrator.
RoleVault.isUserInRole(roleDN, userDN)
Returns true if role is currently assigned to the specified user. The role can be assigned either explicitly or implicitly.
RoleVault.isUserProvAdmin(userDN)
Returns true if the current user is a Provisioning Administrator.
RoleVault.isUserRoleAdmin(userDN)
Returns true if the current user is a Role Administrator.
There are four Bean classes that represent the data returned by the Role Vault API. They are IdentityBean, RoleAssignmentBean, RoleBean, and SodBean. In many cases multiple instances of these beans are returned. If a List is used to return multiple beans, you need to iterate through the list to retrieve the required data. To make it easier to manipulate data from a script, four other Beans classes are provided. They are IdentityBeans, RoleAssignmentBeans, RoleBeans, and RoleBeans. These classes make it easier to retrieve data from individual bean classes without iterating through a list.
The IdentityBean class includes methods for retrieving a DN and an identity type. It includes these methods:
public java.lang.String getDn()
Returns the DN of the identity.
public java.lang.String getType()
Returns the type of the identity. Valid types are:
C: Container
G: Group
R: Role
U: User
The IdentityBeans class includes methods for manipulating one or more IdentityBeans objects or a list of IdentityBeans objects. It includes these methods:
public String[] getDns()
Returns a String Array of DNs.
public String[]getTypes()
Returns a String Array of identity types. Values are:
U: Indicates User
G: Indicates Group
C: Indicates Container
R: Indicates Role
public IdentityBean getIdentityBean(Stringdn);
Returns the Identity Bean with the specified DN.
public int size()
Returns the number of Identity Beans.
public IdentityBean getBean(int n)
n is the index of the required bean.
Returns the IdentityBean at the specified index.
The RoleAssignmentBean class includes methods for manipulating a single RoleAssignmentBean. The methods include:
public long getEffectiveTime()
Returns the role’s effective time. (java.util.Date.getTime()).
public long getExpirationTime()
Returns the role’s expiration time.
public java.lang.String getTargetDn()
Returns the DN. The type of DN is based on the context of the method returning the bean. It can be a DN for a user, group, container, or role.
public java.lang.String getType()
Returns the role’s assignment type. Values can be:
G=Assignment was made through membership in a group.
C=The assignment was made through membership in a container.
E=The assignment was explicit.
R=The assignment was inherited through the role hierarchy.
The RoleAssignmentBeans class includes method for manipulating one or more RoleAssignmentBeans objects as well as a list of RoleAssignmentBeans.
public Long[] getEffectiveTimes()
Returns the role’s effective time.
public long[] getExpirationTimes()
Returns the role’s expiration times.
public String[] getTargetDns()
Returns target DNs. This could be a user, group, container, or role DNs based on the context of the method that returns the bean.
public String[] getTypes()
Returns the assignment types. Values are:
G: Assignment was derived from group membership.
C: Assignment was derived from Container.
E: Assignment was explicit.
R: Assignment was through role hierarchy.
public RoleAssignmentBean getRoleAssignmentBean(String targetDN)
Returns the role assignment bean with the corresponding DN.
public int size()
Returns the number of role assignment beans.
public RoleAssignmentBean getBean(int n)
Returns the Role assignment bean at the specified index.
The RoleBean class includes methods for manipulating a single RoleBean. The methods include:
public java.lang.String getDescription()
Returns the localized role description.
public java.lang.String getName()
Returns the localized role name.
public java.lang.String getRoleDn()
Returns the role’s DN.
public long getRoleLevel()
Returns the role level.
The RoleBeans class includes methods for manipulating one or more RoleBeans as well as a list of RoleBeans. Methods include:
public String[]getDescriptions()
Returns the localized role description.
public String[] getNames()
Returns the localized role names.
public String[] getRoleDns()
Returns the role DNs.
public long[] getRoleLevels()
Returns the role levels
public RoleBean getRoleBean(String roleDN)
Returns the RoleBean with the specified role DN.
public int size()
Returns the number of RoleBeans in the list.
public RoleBean getBean(int n)
Returns the RoleBean at the specified index (n).
The SodBean class includes methods for manipulating a single SodBean. The methods include:
public java.lang.String getDescription()
Returns the SoD’s localized description.
public java.lang.String getName()
Returns the SoD’s localized name.
public java.lang.String getRole1Dn()
Returns a role included in the SoD conflict. No special considerations are made between Role1Dn and Role2Dn.
public java.lang.String getRole2Dn()
Returns a role included in the SoD conflict. No special consideration is made between Role1Dn and Role2Dn.
public java.lang.String getSodDn()
Returns the SoD DN.
The SodBeans class includes methods for manipulating one or more SoDBeans objects along with a list of SodBeans. Methods include:
public String [] getDescriptions()
Returns the localized description of the SoD.
public String [] getNames()
Returns the localized names of the SoD.
public String[] getRole1Dns()
Returns the first role in the SoD conflict. No special consideration is made for Role1Dn and Role2Dn.
public String[] getRole2Dns()
Returns the second role in the SoD conflict.
public String[] getSodDns()
Returns SoD DNs.
public SodBean getSodBean(String sodDn)
Returns the SoDBean with the specified SodDn
public int size()
Returns the number of SodBeans.
public SodBean getBean(int n)
Returns the SodBean at the specified index (n)