Groovy to permit user in a group create only one issue type from severals on a same project

German_Fernandez February 19, 2014

Dear all

i have one project with 5 differents issue types, each one only can be created by one group, is it possible with script-runner?

i've checked with the builtin scripts ("reporter is in a particular group" + "issue type is...") how ever i can not work.

im not a java programmer, woudl you pls help me or at least give me a hint to solve this.

thx so much for your help and support

2 answers

1 accepted

2 votes
Answer accepted
Sameera Shaakunthala [inactive]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 19, 2014

You are very close. Here's what you need:

import com.atlassian.jira.component.ComponentAccessor

def groupManager = ComponentAccessor.getGroupManager()
(groupManager.isUserInGroup(issue.reporter?.name, 'group1') && issue.issueTypeObject.name == 'type1') || (groupManager.isUserInGroup(issue.reporter?.name, 'group2') && issue.issueTypeObject.name == 'type2') || (groupManager.isUserInGroup(issue.reporter?.name, 'group3') && issue.issueTypeObject.name == 'type3')

avanderw June 18, 2015

This worked like a charm

0 votes
German_Fernandez February 20, 2014

thx a lot this was perfect!!!

Suggest an answer

Log in or Sign up to answer