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 2.0.6.
- This routine is available for Jira server and cloud deployment options.
Syntax
isUserInRole(user,project, role)
Description
Returns "true" if the user has a certain role on the specified project.This routine exists starting with Power Scripts for Jira 2.0.6. Before that, you have to get the roles of the user on the project, then check if the necessary role is in the returned list.
Parameters
Parameter name | Type | Required | Description |
---|---|---|---|
User | String | Yes | Username or userkey of the user in question. |
Project key | String | Yes | Key of the selected project. |
Role name | String | Yes | Name of the role that is verified. |
Return type
bool
Returns "true" if the user has the role on a project and "false" otherwise.
Example
Example 1 (Server)
return isUserInRole("mike", "PRJ", "Developers");
Example 2 (both cloud and server versions)
return isUserInRole(currentUser(), "PRJ", "Developers");
Example 3 (Cloud)
return isUserInRole("557058:b540463d-d7fb-43a9-b440-85e1cdbb201e", "PRJ", "Developers");
Notes
On the server the look-up is first made after the userkey, then after the username. On cloud, the look-up is done only by userkey.
See also