ScriptRunner - Override project permissions like in "Bulk Fix Resolutions"

I need to override project permissions to edit closed issues, like it is possible to do in the built-in-script "Bulk Fix Resolutions". I've been digging through the API but could use some help.

I am writing a postfunction where, if the issue being created is linked to another issue, it will add a string to the linked issue's Summary. However, most of the linked issues in this case happen to be closed, and we need to keep closed issues non-editable.

Maybe it is possible to change the permission to editable inside the script, and then after it runs, change it back to non-editable.

I know with "Bulk Fix Resolutions" it is possible to override this so if anyone knows how this is done I would appreciate it.

-Kevin

1 answer

1 vote

Whether an issue is editable or not comes from whether the current user has permission to edit the issue, and whether jira.issue.editable is set on the issue's current step.

As far as I remember only IssueService checks that property, so you could use the lower-level API:

def issueManager = ComponentAccessor.getIssueManager()
...
issue.setSummary("some changed summary")
issueManager.updateIssue(user, issue, EventDispatchOption.ISSUE_UPDATED, false)

 

 

Thanks Jamie. I got an error with issueManager.updateIssue but I was able to solve this with issue.store() and reindexing. -Kevin

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 30, 2018 in Marketplace Apps

Three tips for boosting your board's efficiency with Story Maps

Trello is one of the most effective tools for driving your sprints. It's customizable for every Agile team and product owners and Scrum masters (SM) love it. However, Agile teams often struggle with:...

824 views 2 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you