Script to find users with no groups assigned

Scott Rosenblatt
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 13, 2018

Hi,

I am looking for assistance in running something in Scriptrunner (as I don't have direct DB access) to identify all users who are not in any groups. 

I found this, however it doesn't appear to work with my Jira v7.8.

 

Thanks in advance!

1 answer

1 accepted

1 vote
Answer accepted
Kian Stack Mumo Systems
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 13, 2018

To accomplish, please perform the following: 

Navigate to "Administraton">"Add Ons">"Script Console"

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()).size() == 0}.each{ u ->
result += u.name + "\r\n"
}

result

 

From the link that you provided, I was able to get this running and working. It gave me all usernames that do not have a group attached.

It did throw a couple of warning about deprecated classes, but it seemed to work.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events