So far I have got a script which returns all of the users in my test instance of JIRA.
I have also added to the script so that it is able to get all of the groups too.
However, this is quite basic and I would like to know how people use Groovy in order to retrieve more information (for example: Email, Fullname, login time, project roles and groups they're in etc).
I've been looking through the documentation but I'm feeling somewhat overwhelemed with the different classes and libraries to do different asks.
If anybody has any ideas, or could point my code in the right direction, that would be good.
Thanks
My script:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.bc.user.search.UserSearchService
import com.atlassian.jira.bc.user.search.UserSearchParams
import com.atlassian.jira.web.action.admin.roles.AbstractProjectRole
import com.atlassian.jira.bc.group.search.GroupPickerSearchService
import com.atlassian.crowd.embedded.api.Group
def userSearchService = ComponentAccessor.getComponent(UserSearchService.class);
UserSearchParams userSearchParams = (new UserSearchParams.Builder()).allowEmptyQuery(true).includeActive(true).includeInactive(true).maxResults(100000).build();
userSearchService.findUsers("", userSearchParams).each{ it->
log.error(it.getKey())
}
def groupSearchService = ComponentAccessor.getComponent(GroupPickerSearchService);
def groupArray = groupSearchService.findGroups("")
def groupManager = ComponentAccessor.getGroupManager()
for(Group group in groupArray){
log.error group.getName().toString()
}