Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Restrict Issue Type Creation for Certain Users

Sanjivani Wayal
Contributor
May 15, 2023

We have a Requirement to restrict some users for creating particular issue types

For eg - User1 (these are included in a particular Grp ) cannot Create EPIC

We have Scriptrunner and Automation any way we can do it?

2 answers

1 accepted

1 vote
Answer accepted
Somnath Patil
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.
May 15, 2023

Hi @Sanjivani Wayal ,

 

To restrict Create Epic to users in a particular group, add the  below Jira Expression Validator(Script Runner Jira Expression) to the Create Screen of Epic.

 

!user.groups.includes('Developers')

Sanjivani Wayal
Contributor
May 15, 2023

Hi @Somnath Patil  Can you please help with this where exactly do i need to write this is it in Script Console of Script runner or on some validator or Post function in workflow ?

Somnath Patil
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.
May 15, 2023

Hi @Sanjivani Wayal ,

 

As you mentioned you have ScriptRunner. Add validator on a create screen of Epic and use ScriptRunner Script validator and  paste this cod : !user.groups.includes('Developers')

Replace Developers group name with the name you want to restrict. 

Sanjivani Wayal
Contributor
May 16, 2023

I did that , its not working maybe because i have name of group of users is need to restrict like "JIRA_GRP1" and not a specific name or a single user

Somnath Patil
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.
May 16, 2023

Hi @Sanjivani Wayal ,

 

use :  user.groups.includes('JIRA_GRP1')  If you want User in "JIRA_GRP1" should be able to create issue.

 

use :   !user.groups.includes('JIRA_GRP1')  If you want to User in "JIRA_GRP1" should not be able to create issue.

Sanjivani Wayal
Contributor
May 16, 2023

Hi @Somnath Patil  Thank you so much that really worked 

 

I have 1 more question iam working on Sending Notification emails , However currently its sending the accountid and we need to change it to username and we have issues with customer name those are added in a Group any idea how can i mention it in automation i have created have below example :-

[~accountId:{{user field name.accountId}}]

Hi [~accountid:{{Squad leader.accountId}}], could you please assign this bug to someone on your team?

 

//returns Hi @Alana Grant, could you please assign this bug to someone on your team?

 

But i have the group where user names are added.

Any idea how will it work for Group when that name is mentioned in comments using @

0 votes
Judah
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.
May 15, 2023

You can use a groovy validator (Post-Function) on the Create transition of your Workflow to accomplish this. 

Sanjivani Wayal
Contributor
May 15, 2023

Hi @Judah  Which Post-Function should i use on Create Transition?

Judah
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.
May 16, 2023

@Sanjivani Wayal - You will need to add a Validator. If the validator returns false the transition will be denied (the issue wont be created). 

We used the Scripted (Groovy) Validator provided by JMWE, but ScriptRunner also provides an option for a scripted validator and you would likely pass something like this into the script editor. 

ComponentAccessor.getGroupManager().isUserInGroup(currentUser, "<YOUR GROUP>")


The expression must return TRUE for the transition to occur. Annotation 2023-05-16 093432.png

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events