userRoles
Looking for the documentation on the newest versions of SIL Engine and the Simple Issue Language for Jira 8 for Server/Data Center? Click here !
The availability of the users personal data may be impacted by the recent changes by Atlassian in order to meet GDPR compliance. See the following for more information:
Availability
This routine is available starting with katl-commons 1.0.
This routine is available for Jira server and cloud deployment options.
Syntax
userRoles(project, user)
Description
Returns the roles of the provided user in the project.
Parameters
Parameter name | Type | Required | Description |
|---|---|---|---|
project key | String | Yes | Key of the selected project |
user | String | Yes | Server version: the user name of the user that is verified. Cloud version: the accountId of the user that is verified |
Return type
string []
Returns a list of roles the user associated with the given user has on the specified project.
Example
Example 1 (Server)
//dev1 has the following roles in the project PRJ: developer, tester, business analyst.
string user;
string[] roles;
user = "dev1";
roles = userRoles(project, user);
print ("The user " + user + "has the following roles in the project" + project + ":");
print(roles);
Result: The user dev1 has the following roles in the project PRJ: developer, tester, business analyst. Check the values in log on the next row beginning with <StringPrintRoutine>.
Example 2 (both cloud and server versions)
//current user has the following roles in the project PRJ: developer, tester, business analyst.
string[] roles;
roles = userRoles(project, currentUser());
print ("The current user has the following roles in the project" + project + ":");
print(roles);
Result: The current user has the following roles in the project PRJ: developer, tester, business analyst. Check the values in log on the next row beginning with <StringPrintRoutine>.
Example 3 (Cloud)
//557058:b540463d-d7fb-43a9-b440-85e1cdbb201e is the account id of an user. He has the following roles in the project PRJ: developer, tester, business analyst.
string user;
string[] roles;
user = "557058:b540463d-d7fb-43a9-b440-85e1cdbb201e";
roles = userRoles(project, user);
print ("The user " + user + "has the following roles in the project" + project + ":");
print(roles);