The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

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

Pantham Akhil
Contributor
July 14, 2021

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 that new user added to that admins group. can any one help me to write a groovy script please. thanks in advance

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Tom Lister
Community Champion
August 6, 2021

Hi @Pantham Akhil 

If you have scriptrunner you could look into setting up a Listener on event GroupMembershipCreatedEvent.

There is a listener template to send custom emails.

You can validate which group is affected

import com.atlassian.crowd.event.group.GroupMembershipCreatedEvent
if (event.getGroupName().compareTo("jira-administrators") == 0) {
true
} else {
false
}