Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Permission scheme for custom issue type

Vishu Choudhary December 9, 2021

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
Sebastian Krzewiński
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 9, 2021

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

Vishu Choudhary December 9, 2021

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

Sebastian Krzewiński
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 9, 2021

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
Vishu Choudhary December 14, 2021 edited

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.png image.png

Sebastian Krzewiński
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 15, 2021

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')
Vishu Choudhary December 15, 2021

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

 

image.png image.png

Sebastian Krzewiński
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 16, 2021

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?

Vishu Choudhary December 16, 2021

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 :)

Sebastian Krzewiński
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 27, 2021

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
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Upcoming Jira Events