Jira expressions: provide access to group and role memberships

Description

In Conditions, and especially in Validators, we need to be able to check whether a user (usually the current user) is a member of a group, or a project role. For example, this would allow creating a Validator that will restrict transitions to group or role members and apply it to the Create transition, something that is not possible in standard Jira because there are only conditions to check group or role membership and conditions cannot be used for the Create transition.

Environment

None

Activity

Show:
Krzysztof Kercz
March 6, 2020, 7:49 AM
Edited

Hi ,

Looks like I forgot to add a JSON serializer for the project Role type which is why its returned just as a simple string with the type name (will fix that soon).

To get the role names, you can use map:

 

I’m not sure why your expression returns only one role even though you have two configured. I suppose it’s just how Jira works and that the REST API for roles also would return just one (you can try to compare the results with https://<instance>.atlassian.net/rest/api/2/project/<project-key>/roledetails?currentMember=true)

Ryan Rules
March 10, 2020, 10:28 AM

Thanks Krzysztof! (.map) works a treat and I can get my project-role based expressions working now.

David Fischer [Innovalog]
March 17, 2020, 3:18 AM

Hi ,
it looks like the getProjectRoles method always returns the "Administrator" role, whatever roles the user has. For example, if you run the following Jira expression:

against an issue whose assignee belongs to the Developers role, the expression returns:

Can you please fix that?

Krzysztof Kercz
March 17, 2020, 7:36 AM

Hah, indeed, there is a “small” bug in the code. I’ve just submitted a fix into our pipeline. Thanks for reporting this.

David Fischer [Innovalog]
March 17, 2020, 1:34 PM

Thanks for reacting so quickly!

Fixed

Assignee

Unassigned

Reporter

David Fischer [Innovalog]

Labels

Components

Configure