Hi all,
After searching how I can restrict to single issue type, I came accross with a solution offered by Behaviours.
https://scriptrunner.adaptavist.com/6.9.1/jira/recipes/behaviours/restricting-issue-types.html
The problem I face;
The code snippet has no effect on my side. I use Scriptrunner 6.9.1. I added my group into a role i.e "Extern". This group is only available in "Users" role and "Extern" role. "Users" role has "Browse projects" and "Create Issues" permissions.
After adjusting the code snippet, the user is still able to see all issue types.
<span>import</span><span> com.atlassian.jira.component.ComponentAccessor</span><span>import</span><span> com.atlassian.jira.security.roles.ProjectRoleManager
</span><span>import</span> <span>static</span> com.atlassian.jira.issue.IssueFieldConstants.ISSUE_TYPE
<span>def</span> projectRoleManager = ComponentAccessor.getComponent(ProjectRoleManager)
<span>def</span> user = ComponentAccessor.jiraAuthenticationContext.loggedInUser
<span>def</span> remoteUsersRoles = projectRoleManager.getProjectRoles(user, issueContext.projectObject)*.name
<span>if</span> (remoteUsersRoles == [<span>"Extern"</span>]) {
<span>def</span> constantsManager = ComponentAccessor.getConstantsManager()
<span>def</span> queryIssueType = constantsManager.getAllIssueTypeObjects().find { it.name == <span>"Bug"</span> }
getFieldById(ISSUE_TYPE).with {
setFormValue(queryIssueType.id)
setReadOnly(<span>true</span>)
}
}Is there something wrong with the code snippet or what needs to changed in my case.
Any help much appreciated.