I am trying to prevent users in certain project role from creating issues of certain types.
I set condition like this and it's not working (just issues are created)
for example,
issue.issueType.name in [ 'Epic', 'Story' ] && isUserMemberOfRole('AAA')
my intentions is users in project role 'AAA' cannot create Epic and Story.
Any help will be greatly appreciated.
Hi Hansoo,
I assume we are talking about a scripted validator. Try this:
import com.atlassian.jira.component.ComponentAccessor
import com.opensymphony.workflow.InvalidInputException
def currenUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def issueTypeName = issue.getIssueType().getName()
def projectRole = ComponentAccessor.getComponent(com.atlassian.jira.security.roles.ProjectRoleManager).getProjectRole("AAA")
if ((issueTypeName == "Epic" || issueTypeName == "Story") && isUserInProjectRole(currentUser, projectRole, issue.getProjectObject()) == true){
throw new InvalidInputException("You don't have the permission to create issues of this type!")
}
Thank you very much for your answer.
This is perfect.
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.