Skip to end of metadata
Go to start of metadata

Cprime Apps has been rebranded as Anova Apps. Please note the only effect is the company name - all of our products’ names, logos, functionalities, support, etc. is exactly the same. The new location to our documentation space is https://anovaapps.atlassian.net.

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

UserStringYesUsername 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