Set Security Level based off Assignee

Kathleen Jacobs March 14, 2014

Would like to use Script Runner.

a post function where based off of the Project Role of the assignee, the security level would change to X

2 answers

0 votes
Boris Georgiev _Appfire_
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.
March 15, 2014

0 votes
Boris Georgiev _Appfire_
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.
March 15, 2014

Here's a sample:

import com.atlassian.jira.ComponentManager
import com.atlassian.jira.component.ComponentAccessor

im = ComponentManager.getInstance().getIssueManager()
prm = ComponentAccessor.getComponent(com.atlassian.jira.security.roles.ProjectRoleManager.class)
role = prm.getProjectRole("Managers");
//issue = im.getIssueObject("MKT-14")
// in the post function you should have issue variable in the context of the script
if(prm.isUserInProjectRole(issue.getAssigneeUser(),role,issue.getProjectObject())) {
	issue.setSecurityLevelId(10000);
        issue.store();
}

Boris Georgiev _Appfire_
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.
March 15, 2014

Note that the user executing the transition should have "Set Issue Security" Permission for that project/issue, so the postfunction is able to set the level

Suggest an answer

Log in or Sign up to answer