SFU.getUserSecurityGroup()
- Last UpdatedJun 25, 2024
- 1 minute read
Use SFU.getUserSecurityGroup() method to get the effective security group of a user.
Syntax
SFU.getUserSecurityGroup(userIdWithProvider)
Parameters
|
Parameter |
Description |
|---|---|
|
userIdWithProvider |
User Id of the user for whom the security group is fetched. This parameter is optional. If the parameter is not passed, it fetches the roles for the current logged-in user. |
Return Value
Effective Security Group of the User.
Example 1
// Gets the Effective Security Group for the logged-in user
var securityGroup = SFU.getUserSecurityGroup();
// securityGroup variable would get a value like- "Administrator"
Example 2
// Gets the Effective Security Group for the User with Id "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX".
var securityGroup = SFU. getUserSecurityGroup("skeltalist::XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX");
// securityGroup variable would get a value like- "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