how to validate a users in a particular group in jira using groovy

Hi all, we have 5 users in Jira-admins group so we don't want add any add any other user to that group, if any user accidentally added to that group then an eamil has to be sent to me or my manager ...

5 comments

Mentorship4U July 14, 2021

Hi Pantham,

Everything you need to create a script like that is here (listing users in a given group), and here (sending e-mails using groovy). Based on this, you can create a script that does what you need. It could be a scripted service that runs the script periodically, ScriptRunner allows for this.

I encourage you all to follow my Groovy for Jira Blog.

Pantham Akhil July 14, 2021

Hi @Mentorship4Utnq for quick response but  the answer is not suitable for me becoz we don't want add a new user to admin group bt in that link the user want add a users to another group.

Ismael Jimoh
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.
July 14, 2021

@Pantham Akhil there is no way to stop your administrators adding users to a specific group. 

As such, the first thing is to do here is to make sure that the administrator group is not set as a default user group users can be added into.

Next, as suggested by @Mentorship4U build a script whenever a new user is added to the group so you can see and validate if it is indeed needed. You can then go to the audit log page to confirm who added the said user to the group and confirm why as well.

Unfortunately, there is no way to directly stop an administrator from adding a new user to a group.

You can consider raising a feature request at https://jira.atlassian.com (do check if such a feature request exists first before raising a new one and vote for existing ones.)
Regards.

Pantham Akhil July 14, 2021

Hi @Ismael Jimoh tnq for the response we don't want to stop admins to stop adding users to that group the admin accidentally add any new user to jira-admins group then one email needs to be sent to an admin either me r others. so the script needs to compare the hard codded list of admins and new list everyday and if there is any new user added then it needs to be notified by sending an email. This is what my exact requirement. can you please help me in this . tnq

Regards,

Akhil

Ismael Jimoh
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.
July 15, 2021

Hi @Pantham Akhil 

Are you asking for us to write the script for you? From my understanding of your prior comment you said you wanted a notification before the user is added which as I explained isn’t possible.

Please clarify what help you need exactly.

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events