We want to limit the creation of all issue types except for one. We have a separate workflow for the issue type that the users are allowed to create.
I tried solving this with a custom script validator (ScriptRunner) on the creation transition, which I based off of an example script:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.roles.ProjectRoleManager
// the name of the project role
def roleName = '_project_admin'
def projectRoleManager = ComponentAccessor.getComponent(ProjectRoleManager)
def role = projectRoleManager.getProjectRole(roleName)
projectRoleManager.isUserInProjectRole(issue.reporter, role, issue.projectObject)
Try the following:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.security.roles.ProjectRoleManager import static com.atlassian.jira.issue.IssueFieldConstants.ISSUE_TYPE def projectRoleManager = ComponentAccessor.getComponent(ProjectRoleManager) def user = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser() def issueTypeField = getFieldById(ISSUE_TYPE) def userRoles = projectRoleManager.getProjectRoles(user, issueContext.projectObject)*.name def availableIssueTypes = [] if ( "Users" in userRoles) { availableIssueTypes.addAll([ "Query" , "General Request" ]) } if ( "Developers" in userRoles) { availableIssueTypes.addAll([ "Bug" , "Task" , "New Feature" ]) } issueTypeField.setFieldOptions(availableIssueTypes) |
As detailed in Doc Restricting Available Issue Types
Best regards
Sam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Nils Althaus Welcome to the community!
You may use the Permission Validator on issue creation and select the project role to restrict issue creation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I actually didn't think of that. In our specific case, this will work since the users who are not allowed to create the other issue types are in a different role with fewer permissions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.