Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Work Tasks

SFU​.getUserRoles()

  • Last UpdatedJun 25, 2024
  • 1 minute read

Use SFU.getUserRoles() method to get the roles of a user.

Syntax

SFU.getUserRoles(userIdWithProvider)

Parameters

Parameter

Description

userIdWithProvider

User Id of the user for whom the roles are fetched.

This parameter is optional.

If the parameter is not passed, it fetches the roles for the current logged-in user.

Return Value

Roles of the User. If the user has multiple roles, comma separated string of the roles is returned.

Example 1

// Gets the Roles for the logged-in user

var roles = SFU.getUserRoles();

// roles variable would get a value like- "Everyone,skeltalist::Admin"

Example 2

// Gets the Roles for the User with Id "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"

var roles = SFU.getUserRoles("skeltalist::XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX");

// roles variable would get a value like- "Everyone,skeltalist::Contributor"

The userIdWithProvider value varies based on the authentication provider configured. This value should have the Entity instance mapped for the repository to be prefixed along with real id of the user.

  • If the repository is mapped to Repository User Provider, the userIdWithProvider will be skeltalist::[GUID]. Here the GUID is of the user john, taken from SKEUsers table present in the Repository DB.

    For example: skeltalist:: C99B4110-C8CC-410B-BF70-93F3A7E34EDF

  • If the repository is mapped to the Active Directory user provider, the userIdWithProvider will be activedirectory::[samAccountName]. Here, samAccountName is an active directory property value.

    For example: activedirectory::john

    Note: The SFU.getUserRoles() method does not work in AVEVA Work Tasks Pro app.

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in