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!")
}
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.