Issue Security Scheme: Auto-assign by Reporter?

I have 10+ groups in my issue security scheme. I want the ticket to auto generate this security level based on the Reporter's group. For example, he is from group C. When he creates this ticket, I want the field for security level I created from the security scheme to auto-assign it as group C. So only users with group C can see this access and not group A and etc... post-function1.png

2 answers

Hi Erica,

If I understand right the requirement, I suppose you have x groups and y security issues.

I can see two possible solutions.
The first one is to create 10 Set issue security lvl post functions. Each one will have a condition. For example

for users who belong to group a - their issues should have the Security lvl A

import com.atlassian.jira.component.ComponentAccessor
def groupManager = ComponentAccessor.getGroupManager()
groupManager.isUserInGroup(issue.reporter?.name, 'group a')

Name of security lvl: Security lvl A

for users who belong to group b - their issues should have the Security lvl b

import com.atlassian.jira.component.ComponentAccessor
def groupManager = ComponentAccessor.getGroupManager()
groupManager.isUserInGroup(issue.reporter?.name, 'group b')

Name of security lvl: Security lvl b

etc... 
One post function under the other. But you have to be careful and very precise with your conditions.
The other solution is to have a single custom post function which actually will do the same. The disadvantage is that you have to write your own script for that but it will be much easier to maintain and debug it or event extend it. 
Hope I understand right the requirements. Please let me know if you need further assistance.
regards, Thanos

Thank you Thanos for your response. Greatly appreciate it. What setting should the screen shot be in the drop down? I left it none because I wanted to make sure that it just doesnt auto assign to that specific group.

security.png

 

Suggest an answer

Log in or Join to answer
Community showcase
Teodora [Botron]
Published Feb 15, 2018 in Marketplace Apps

Jira Inferno: The Nine Circles of Jira Administration Hell

If you spend enough time as a Jira admin - whether you are managing a single, mid-sized instance, a large enterprise one or juggling multiple instances at once - you will eventually find yourself in ...

1,223 views 6 19
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot