Issue type restriction according user

Charlot Attard October 4, 2017

We want to create a condition were a specific user can create a specific issue type. We know we have to create a validator in the workflow, but we don't know how shall we construct the script validator.

In our scenario, we have a user which has to create only bugs, in the same projects there are more issue types available. But we are restricting this user that he can only create 'bugs' as an issue type.

Can you please help

3 answers

4 votes
Ethan Foulkes October 10, 2017

Hi Charlot,

You can do this using the Power Scripts add-on.

There is a video tutorial walking you through in detail here.

Code is simple:

string [] testers = usersInRole("TEST", "Product Development Tester");

string error = "You do not have permission to create this issue type!";

if(elementExists(testers, currentUser()) && type != "Story") {
    return false, "error", error;
}
0 votes
Ethan Foulkes October 8, 2017

Hi Charlot,

Can you describe a bit more about the restrictions you require? Is it literally just 1 user that you want to limit to only creating bugs or is it 2 different types of users? If the latter then do you have them split out by groups or roles etc?

Charlot Attard October 8, 2017

I have a user which I want to restrict issue creation restriction according to the issue type. In my case user "a" can only create bug issues. I have created a specific workflow for issue type bugs. Now I want that this particular user to create only bugs, creation of other issue types would not be possible with this user.

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 4, 2017

You need to have two workflows.  One with a validator on the create transition that simply says "if user does not match a rule, return false" (I'd recommend you also return an error message for them).  The other one does not need a validator.

Use the one with the validator for most issues, and the other one for bugs.

Charlot Attard October 6, 2017

Hi Nic,

Thanks a lot for your reply.

Can you please let me know how to implement the validator rule. Should it be a scripted condition or a user permission validator ?

I have implemented two different workflows.

Thanks a lot,
Charlot

Suggest an answer

Log in or Sign up to answer