Extract list of users who are part of "Confluence-user" group

Karthick Kumar M May 1, 2023

Hi,

Is it possible to extract the list of users who are part of "Confluence-user" group with a groovy script that can be ran in script runner? If anyone has any script or any other workaround for this use case it would be helpful. We are doing this activity manually every week and we are spending around 2 hrs, any help would be appreciated.

Regards,

Karthick

1 answer

1 accepted

2 votes
Answer accepted
Radek Dostál
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 2, 2023

The most bare bones approach would be this

 

import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.user.Group
import com.atlassian.user.GroupManager

GroupManager groupManager = ComponentLocator.getComponent(GroupManager)
Group group = groupManager.getGroup("confluence-users")

final StringBuilder stringBuilder = new StringBuilder()
final String LF = "<br>"

for (String username : groupManager.getMemberNames(group)) {
stringBuilder.append(username).append(LF)
}

return stringBuilder.toString()
Karthick Kumar M May 3, 2023

Thanks! it works perfectly...

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events