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.
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)
Thanks Krzysztof! (.map) works a treat and I can get my project-role based expressions working now.
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?
Hah, indeed, there is a “small” bug in the code. I’ve just submitted a fix into our pipeline. Thanks for reporting this.
Thanks for reacting so quickly!