What's the proper way to rename a security level in scriptrunner?

The IssueSecurityLevelManager interface has a method named updateIssueSecurityLevel whose description is “Updates the name and/or description of security level.” The description matches what I am trying to accomplish.

However, I see a problem. The only parameter is an instance of issueSecurityLevel. Looking at its interface, I see only get methods. There is no setName nor setDescription defined. So I can’t see a way to change a name or description of an existing issueSecurityLevel.

Where possible, try not to use *Manager classes in Jira. OR at least check out how Atlassian uses them in the source code. The manager classes typically do not throw events, properly clear caches, etc. Just a word to the wise.

In this case, you can use IssueSecurityLevelService which gives you a update method for changing the name and description, and it will properly deal with any other things that need handling.


Sorry I didn’t reply sooner but thanks for the pointer. I was able to user your link to resolve my initial problem. I’ve run into another. I want to make a copy of an existing Security Scheme. I can do that using copyScheme(scheme) and it will create “Copy of {original_scheme_name}”. I’ve yet to find the method to rename the copied scheme. I don’t see an equivalent method in IssueSecurityShemeService. I’ve also tried looking through the source but haven’t found the appropriate function that actually performs the rename from the UI.