Set security level with Behaviour plugin

Dieter Scheruga February 12, 2015

Hi,

it's simple to set set security level within a groovy script f.e. in a post function. That's working.

But how do I set the security level using the behaviour plugin?

I want to set a security level if a checkbox "confidential" is enabled.

Problem : How do set the security level on the issue and how to store?

 

This ist not working:

IssueSecurityLevelManager issueSecurityLevelManager = ComponentAccessor.getIssueSecurityLevelManager ();
Object id = getFieldById("id")
MutableIssue missue=ComponentManager.getInstance().getIssueManager().getIssueObject(Long.parseLong(id.value))

IssueSecurityLevel secLevel= issueSecurityLevelManager.getSecurityLevel (10130L);
missue.setSecurityLevelId(secLevel.id);
missue.store();

Thanks

Dieter

 

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Dieter Scheruga February 12, 2015

Thanks Jamie for your reply.

For a post-function a transition in the workflow is needed. I want to change the sec. level before during edit of call.

It works when I just hide the sec level box in the edit mask.

And I found your hint using getUnderlyingIssue() smile

IssueSecurityLevelManager issueSecurityLevelManager = ComponentAccessor.getIssueSecurityLevelManager ();
IssueSecurityLevel secLevel= issueSecurityLevelManager.getSecurityLevel (10130L);
getUnderlyingIssue().setSecurityLevelId(secLevel.id);
 getUnderlyingIssue().store();

 

Thanks

Dieter

0 votes
JamieA
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.
February 12, 2015

If the confidential checkbox is selected, then just set the security level in a post-function...

I suspect the way you are doing it there, when the user saves the form, it's just overwriting the security level with whatever the browser sends, even if it's nothing. I don't think you should modify the issue in the background from the behaviour, and if you did you should use IssueManager or IssueService to update the issue.

TAGS
AUG Leaders

Atlassian Community Events