Script for group memberships

TamasS May 5, 2014

Hi,

do you know a script (jelly, groovy) we could have those users that are members of group X but not members ogf group Y?

THanks,
Rumi

1 answer

1 accepted

0 votes
Answer accepted
Henning Tietgens
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 5, 2014

Here is a groovy script which finds all users in Group A which are not in Group B.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.util.UserUtil

UserUtil userUtil = ComponentAccessor.getUserUtil()

result = ''

userUtil.getUsers()
        .findAll{userUtil.getGroupsForUser(it.getName())*.name.contains('Group A')}
        .findAll{!userUtil.getGroupsForUser(it.getName())*.name.contains('Group B')}
        .each{ u ->
    result += u.name + "\r\n"
}

result

Suggest an answer

Log in or Sign up to answer