Hello guys,
I am implementing a java plugin to manage automatic apply of security issue on JIRA Core. I can apply security level on update event with custom security rule. I want to add a custom behaviour which is :
My issue has a security level applied.
if no automatic security rules apply anymore
then remove the security level programmatically
I tried :
MutableIssue mi = issueManager.getIssueByCurrentKey(event.getIssue().getKey());
mi.setSecurityLevelId(-1L);
issueManager.updateIssue(adminUser, mi, EventDispatchOption.DO_NOT_DISPATCH,
false);
or
mi.setSecurityLevelId(null);
issueManager.updateIssue(adminUser, mi, EventDispatchOption.DO_NOT_DISPATCH,
false);
This code does not apply what I expected, I do not know how to proceed, do you have a suggestion ? :)
Thank you in advance
Hi @Aktarel,
I've just found your question. As I was working on a similar function, for me in Jira 7.10.2 this works just fine.
The script creates an exact copy within another project but removes the security scheme.
MutableIssue mutableIssue = issueManager.getIssueByCurrentKey(newIssue?.key);
mutableIssue.setSecurityLevelId(null);
issueManager.updateIssue(AUTH_USER, mutableIssue, EventDispatchOption.DO_NOT_DISPATCH, false);
The already created issue does not have any security level afterwards.
What did you expect to happen or what is the result of the code above?
Best regards
Hello Andreas,
The code you submitted is OK.
I was distracted when testing the second code I sent, it remove the issue security as expect when setted null.
Best regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Aktarel
great to hear :)
From what I found within the API Documentation setting the security level to null should be the correct way.
if you check the method getDefaultSecurityLevel() provided by the IssueSecurityLevelManager, It might retune null. In my use case I've used the method to get the default security level of a project while cloning an issue to a new project. So instead of removing the level and setting the default, I always set the default level which is null, if there is no security level set for the project.
Result: the security level is set to null and the issue is "visible for everyone".
Source: IssueSecurityLevelManager.getDefaultSecurityLevel()
Maybe this helps you in addition.
Best regards
Andreas Morgner
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.