I am a jira-administrator and have a project that has four issuetypes. Three of the issueypes may be created by jira-users, who have been granted Create permissions in the project's Permission Scheme. However, the fourth issuetype needs to limit the reporter to the member of a project role group (e.g., Generic Role 4). Can the Simple Scripted Validator be used for this purpose? If so, what would the script look like?
I am aware of the following sample script, but I believe it is only for JIRA instance groups.
def groupManager = ComponentAccessor.getGroupManager()
We are using Script Runner v3.0.16.
Many thanks for your assistance!
I think in your case you can use the projectRoleManager, it should be something like this
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.security.roles.ProjectRoleManager def userManager = ComponentAccessor.getUserManager() def user = userManager.getUserByName(issue.reporter?.name) def projectRoleManager = (ProjectRoleManager) ComponentAccessor.getComponentOfType(ProjectRoleManager.class); // name of role here def devsRole = projectRoleManager.getProjectRole("Developers") return projectRoleManager.isUserInProjectRole(user, devsRole, issue.getProjectObject())
Hope this helps.
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG