How to restrict some issue types to some groups ?

LaurentV December 13, 2011

hi,

We want some of our issue types to be used only by some user groups. Is there a way to do that ?

Regards,

12 answers

2 accepted

4 votes
Answer accepted
Priyanka Lavania
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 28, 2019

Hi,

I solved this issue using Script runner's behavior, used below code in initializer and it showed Issuetypes based on logged in user, you can validate user against project roles or even groups

 

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 allIssueTypes = ComponentAccessor.constantsManager.allIssueTypeObjects

def user = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def issueTypeField = getFieldById(ISSUE_TYPE)
def availableIssueTypes = []

//use this def and if code to check project roles
/*def remoteUsersRoles = projectRoleManager.getProjectRoles(user, issueContext.projectObject)*.name

if ("Testers" in remoteUsersRoles)
{
availableIssueTypes.addAll(allIssueTypes.findAll { it.name in ["Task", "Experiment"] })
}
*/

//use this def and if code to check groups
def remoteUsersRoles = ComponentAccessor.getGroupManager().isUserInGroup(user, "jira-administrators")
if (remoteUsersRoles) {
availableIssueTypes.addAll(allIssueTypes.findAll { it.name in ["Task", "Experiment"] })
}

else {
availableIssueTypes.addAll(allIssueTypes.findAll { it.name in ["Task"] })
}

issueTypeField.setFieldOptions(availableIssueTypes)

 

Hope this helps.

 

Regards,

Priyanka

Zita Bagi
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 28, 2020

Hi Priyanka Lavania,

thank you very much, this actually worked for me! :)

Like Priyanka Lavania likes this
Priyanka Lavania
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 28, 2020

Glad to know :) 

Prasad Andrews April 15, 2020

Hi @Zita Bagi , @Priyanka Lavania 

 

I have a similar requirement, could you suggest me how to achieve this...

Total of 10 components in my project and 2 issues types. Based on the issue type components will display.

For e.g.- Defect and Enhancement are the two issue types in a project if i select the Defect then 5 components should display.

How do I achieve these using behaviors?

 

Regards,

Andrews

Orly Dahan December 24, 2020

Hi, Can you please explain where do I need to add this script? 

I cannot find behavior in Scrip Runner

Priyanka Lavania
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 10, 2021

Hi @Orly Dahan

If you have jira-admin access then you can go to Manage AddOns->ScriptRunner->Behaviours

Add a Behaviour and and add above script as initializer

 

Regards,

Priyanka

Priyanka Lavania
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 10, 2021

Hi Andrews,

I have not tried on Components, but I am able to display select list based on Issuetypes.

Let me know if you still need it, will post the code.

Regards,

Priyanka

Like Prasad Andrews likes this
Prasad Andrews July 13, 2021

Hi @Priyanka Lavania -

Yes, I need it could you please post the code.

 

Regards,

Andrews

0 votes
Answer accepted
Jobin Kuruvilla [Adaptavist]
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.
December 13, 2011

This is not possible in JIRA. See https://jira.atlassian.com/browse/JRA-5865

Look at the issue and its linked issues to find different workarounds.

Justin Leader June 19, 2013

Great answer!

1 vote
Alejandro Reyes April 8, 2019

Scriptrunner has an option on behaviours to do this on their newest version:
https://scriptrunner.adaptavist.com/5.5.0.3-jira8/jira/recipes/behaviours/restricting-issue-types.html

Hope it helped.

Priyanka Lavania
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 28, 2019

I used behaviour to do this for groups, which worked like charm. Thanks

Like Kevin Gomes likes this
1 vote
Young Plugins March 3, 2014

I recently developed a plugin that might help. I'm open for ideas to make it better. Cheers

1 vote
Joe Pitt
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 13, 2011

As Jobin said, this isn't possible. There are some work-arounds in the jra-5865 he points to, but all have some kind of problem. the cleanist way, in my opinion, to do it is to put the different issue types in different projects since permissions are at the project level.

0 votes
Harish Tirumalasetty June 28, 2019

it is possible with SIL programm.

0 votes
Young Plugins March 1, 2019

Contact me on youngplugins@gmail.com for a good deal on the plugin "Issue Type Filters"

0 votes
Manmohan Gopal February 28, 2019

If you are JIRA Admin, You can create issue scheme and associate your project to restrict issue types as you need. I have same issue and solved creating scheme.

Note: If you have already issue created which is not part of your required list then those will be prompted update to existing ones

0 votes
Cindy October 3, 2018

You can do this with workflow conditions if still needed.

Nagendra Dattatreya November 24, 2018

Hey Cindy,

Can you elaborate on how to achieve this? I want to restricts "Support group" to create bugs but should not be allowed to create stories.

Thanks,

Nagendra

Swetha Bammidi December 11, 2018

Any solution on this

Cindy December 11, 2018

You could use the addon Jira workflow toolbox to create a validator on the create transition.

0 votes
Dieter
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.
December 13, 2011
So Jobin answer applies
0 votes
LaurentV December 13, 2011

my question is about creating issues

0 votes
Dieter
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.
December 13, 2011
Please be more specific about what the groups should be able to do (create issues, edit issues, view issues, transition issues...)

Suggest an answer

Log in or Sign up to answer