Need validator for assignee in role

Adam White November 29, 2016

I just need a validator script for a transition. I'd like a validator for when an assignee has to be in a certain project role. 

 

I found this code: 

import com.atlassian.jira.ComponentManager
import com.atlassian.jira.security.roles.ProjectRole
import com.atlassian.jira.security.roles.ProjectRoleManager

ComponentManager componentManager = ComponentManager.getInstance()
ProjectRoleManager projectRoleManager = ComponentManager.getComponentInstanceOfType(ProjectRoleManager.class) as ProjectRoleManager
ProjectRole devRole = projectRoleManager.getProjectRole("Lead Software Developer")

projectRoleManager.isUserInProjectRole(issue.assignee, devRole, issue.projectObject)

 

But I dont think it will be future-compatible with JIRA 7. I'm currently on 6.4.11.

1 answer

0 votes
Jonny Carter
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.
November 30, 2016

There is a built-in method and example for this in Simple Scripted Validator.

isUserMemberOfRole('Lead Software Developer')

Suggest an answer

Log in or Sign up to answer