Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Permission scheme for custom issue type

I have created some custom issue types Test Cases, Business Requirements, Other Requirements, and want to restrict the actions based on the issue types. Foe example: only testers in a group "Testers" can create the Test Cases issue type. Only BA/PO can create Business Requirements,... How can we achieve this in Jira. I couldn't find a place to control the permission scheme for custom issue types.

1 answer

0 votes

Hi @Vishu Choudhary 

 

You can't do this based on project permission scheme because permission scheme set permissions for whole project.

You can achieve this by using custom validators provided by apps (eg. Script runner, JMWE)

 

Regards,

Seba

Thanks for the response Seba. Do you know how can it be done via Script runner?

Hi

 

This code I used in workflow which is shared with many issue types in project:

import com.atlassian.jira.component.ComponentAccessor

def groupManager = ComponentAccessor.getGroupManager()

if (issue.issueType.name =='<Issue type name>') {
if (groupManager.isUserInGroup(issue.reporter?.name, '<Group name>')) {
return true
} else return false
} else return true

Hello,

I'm getting multiple errors while applying the above code. One of them is attached.

Basically, I want to restrict the access for BA (under BA Test group) for creating/viewing the Business Requirement issue type (custom issue type).

Please advise.

Thanks,

Vishuimage.pngimage.png

1. You need to replace whole <Issue type name>. Is should be 'Business Requirements'

2. Group should be:

if (groupManager.isUserInGroup(issue.reporter?.name, 'Ba test group')

Tried the above code and got two more errors. Sorry, I'm new to scripting in ScriptRunner. 

 

image.pngimage.png

Hi

 

What is the 'ba' variable in line 6? Where do you declare it?

Error from line 5 - where you put this code? Script console, validator, console?

ba is the username of the user who is in group "BA Test group".

I have a bit of a change in the original requirement. Now I want to restrict the access based on the group. For example: only the users who are in "BA Test group" should be allowed to create the Issue Type "Business Requirements". I have different workflows based on different custom issue types. So, I want to add this script in the create part of the workflow and then adding a Validator. 

Currently, I have tried running this script in ScriptRunner console but it should be run in Validator of the workflow, right?

Please advise the script for the above. Thanks :)

To test it in Script console you need to define issue and put user in ''.

Script should look like this:

import com.atlassian.jira.component.ComponentAccessor

def groupManager = ComponentAccessor.getGroupManager()
def issue = ComponentAccessor.getIssueManager().getIssueObject('issueKey')

if (issue.issueType.name =='Prośba o usługę') {
if (groupManager.isUserInGroup(ba', 'BA Test group')) {
return true
} else return false
} else return true

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you