getLoggedInUserDetail
This method returns an object containing details of the organizational status of the currently logged in user, including the groups and positions the user is a member of, as well as the privileges associated with the user.
Parameters
- version - (string) The version of the organization model from which to obtain the user details (-1 for the latest version).
- forceRefresh - (boolean) When the getLoggedInUserDetail method is executed, a request is sent to the server to obtain user details and the results are cached locally. This avoids unnecessary subsequent server requests that would likely obtain the same results. Setting forceRefresh to true causes any cached results to be discarded and a new server request to be issued.
Returns
- oDetail - (Object) Provides detailed information about the logged-in user with the following properties:
- oDetail.guid - (string) A unique identifier for the resource.
- oDetail.name - (string) The name of the resource.
- oDetail.containerId - (string) ID of the container used to create the resource.
- oDetail.containerName - (string) The name of the container used to create the resource.
- oDetail.groups - (object) Contains a property for each group the resource is a member (see below or additional information).
- oDetail.positions - (object) Contains a property for each position the resource holds (see below or additional information).
- oDetail.privileges - (object) Contains a property for each privilege the resource holds (see below or additional information).
- oDetail.capabilities - (object) Contains a property for each capability specified for the resource (see below or additional information).
- oDetail.attributes - (object) Contains a property for each attribute specified for the resource (see below or additional information).
- oDetail.pushDestinations - (object) Contains a property for each push destination set up for the resource (see below or additional information).
Note: All of the objects above are used to hold a collection of similar subordinate objects. The property name used to reference the subordinate object is also used as the name of that object. For instance, if the resource is a member of a group named CustomerService, there is a property named
oDetail.groups.CustomerService that is an object, where:
oDetail.groups.CustomerService.name = 'CustomerService';
Each Object under
oDetail.privileges has the following properties:
- guid - (String) unique identifier
- name - (String) unique name
- label - (String) display name (may not be unique)
- values - (Object []) Array of objects, each representing one way in which the privilege has been granted. The privilege may be granted through any number of memberships with an optional qualifying value.
- value - (String) an optional value that qualifies the privilege
- originGuid - (String) unique identifier of position or group granting the privilege
- originName - (String) unique name for the position or group
- originLabel - (String) display name for the position or group (may not be unique)
- originType - (String) either 'POSITION' or 'GROUP'
You can verify a privilege has been granted in some way (any value) in this way:
var bPrivilegeHeld = oDetail.privileges.SecureAccess != null;
To check for a specific value you will need to loop through the array of Values:
var bPrivilegeHeld = false; for (var x=0; x<oDetail.privileges.SecureAccess.values[x]; x++) { if (oDetail.privileges.SecureAccess.values[x]=='Level9') { bPrivilegeHeld = true; break; } }
To verify a specific privilege with a specific value is granted through a specific membership:
var bPrivilegeHeld = false; for (var x=0; x<oDetail.privileges.SecureAccess.values.length; x++) { var oItem = oDetail.privileges.SecureAccess.values[x] if (oItem .Value=='Level9' && oItem.OriginName=='ChiefOfSecurity') { bPrivilegeHeld = true; break; } }
Each Object under
oDetail.capabilities has the following properties:
- guid - (string) unique identifier
- name - (string) unique name
- label - (string) display name (may not be unique)
- dataType - (string) type of data held in the Value property
- value - (various data types) value specified for the capability. These are the DataTypes followed by the JavaScript type used to represent them. When DataType is blank the Value will be null.
Each Object under oDetail.attributes has the following properties:
- guid - (string) unique identifier
- name - (string) unique name
- label - (string) display name (may not be unique)
- dataType - (string) type of data held in the Value property
- value - (various data types) value specified for the capability. These are the DataTypes followed by the JavaScript type used to represent them. When DataType is blank the Value will be null.
Each Object under oDetail.pushDestinations has the following properties:
- enabled - (boolean) true if work items directed at this channel should be pushed to the user
- channelType - (string) type of push destination (at this time, only "EmailChannel" is used)
- channelId - (string) identifier for the channel
- target - (string) information used to address the work to the user, (at this time, only email addresses are used). Note that the target could be a unique value that was entered for this push destination, or it could be a value retrieved from a resource attribute. If it comes from a resource attribute, the following three properties will also contain information:
- attributeGuid - (string) GUID of the resource attribute
- attributeName - (string) unique name of the resource attribute
- attributeLabel - (string) display name of the resource attribute (may not be unique)
Copyright © Cloud Software Group, Inc. All rights reserved.