Forums

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

script runner script i can use as restful endpoint to list all Jira users in groups

walter hicks
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!
December 19, 2019

1 Details list of all Jira Users and Group

2 Script should print out Jira Users and what Group users are assigned

3 Should be able to access the page via 

<jira_base_url>/rest/scriptrunner/latest/custom/doSomething

similar to documenation in https://scriptrunner.adaptavist.com/latest/jira/rest-endpoints.html?utm_source=product-help

1 answer

1 accepted

0 votes
Answer accepted
walter hicks
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!
December 19, 2019

Groovy Script prints username and group membership

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.bc.group.search.GroupPickerSearchService
import com.atlassian.crowd.embedded.api.Group
def groupSearch = ComponentAccessor.getComponent(GroupPickerSearchService)
def groupList = groupSearch.findGroups("")
def groupManager = ComponentAccessor.getGroupManager()
for (Group group in groupList){
log.error group.getName().toString()//print group names to log
log.error groupManager.getUsersInGroup(group)//print group members to log
}

Suggest an answer

Log in or Sign up to answer