Hello,
We're new to Jira Cloud coming from Jira Server. We have a Project with IssueTypes such as Story, Bug, Inquiry.
We have some users who we want to limit to Creating the Inquiry IssueType only.
How can this be achieved?
We have access to JMWE full plugin. We used to be able to use groovy script Validator on the Create transition to restrict it by checking if a user was in a restricted Role:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.roles.ProjectRoleManager
def projectRoleManager = ComponentAccessor.getComponent(ProjectRoleManager)
def roles = projectRoleManager.getProjectRoles(currentUser, issue.projectObject)
return roles.find { role -> role.name.equals("Software Support Analyst")} == null;
Any guidance is appreciated.
Hi @Patrick Chen ,
on Jira Cloud, you can use a Build-your-own Validator, but the script must be written using Jira's own Jira Expressions language.
The equivalent of the Groovy script you shared would be:
user.getProjectRoles(issue.project).some(pr=>pr.name == "Software Support Analyst")
To restrict the creation of issue to the Inquiry issue type for member of that project role, you could do:
!user.getProjectRoles(issue.project).some(pr=>pr.name == "Software Support Analyst") || issue.issueType.name == "Inquiry"
Thanks David! We adapted the script you provided and used JMWE to successfully apply a Role based restriction on select Issue Type creation!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @David Fischer ,
I want to restrict Epic creation based on project role.
I want only "Administrator" of that project should be able to create Epic. Is that possible?
For all the project I want to add this validator. Kindly help!
I am using JMWE plugin -> Build your own validator.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @rbalamu2 ,
this is almost exactly what was provided before... In your case, the script would be:
issue.issueType.name != "Epic" || user.getProjectRoles(issue.project).some(pr=>pr.name == "Administrator")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
I want to restrict Epic creation based on project role.
I want only "Administrator" of that project should be able to create Epic. Is that possible?
For all the project I want to add this validator. Kindly help!
I am using JMWE plugin -> Build your own validator.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Not this code, no, as it is written in Jira Expressions, which is Jira Cloud-specific. On Server/DC, you need to use Groovy:
issue.get("issuetype").name != "Epic" || currentUser.isInProjectRole("Administrator", issue.get("project"))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks David. Would I create that under Shared Groovy Script Editor? I dont see any other place that this would work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Eric Sebian ,
this is meant to be used in a Scripted (Groovy) Validator.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ahh. So, it won't block a requester from selecting a specific issue type. Just restricts them from completing the request. Good to know. Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.