Can a ScriptRunner validator be run as a privileged user?

C_ Derek Fields
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 20, 2022

I have a validator expression but it requires elevated permissions because I am trying to retrieve the Project Roles of the current assignee to ensure that they are in an appropriate role for assignment. 

The script is pretty simple:

roles = "Role A, Role B, Role C"
issue.assignee.getProjectRoles(project)
.map(r => r.name)
.filter(i => roles.includes(i))
.length > 0

This will check to see if any of the project roles is one of the listed roles. 

The problem is that I get an error message: "You must be the project administrator to access roles of other users"

Is there any way to run this as the add-on user rather than as the current user?

1 answer

0 votes
Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 11, 2022

Hi Derek,

Thank you for your question.

I can confirm that currently in ScriptRunner for Jira Cloud tht validators can only be run as the current user.

The reason for this is that they use the Jira expression framework that Atlassian provides for this feature and do not interact with the rest API like other scripts.

If this a feature you would find valuable then can you please raise this as a card on our feature board located here so that the product owner for ScriptRunner for Jira cloud can see this.

I hope this information helps.

Regards,

Kristian

Suggest an answer

Log in or Sign up to answer