I'm currently attempting to find all users in a group then add all of them to another group using scriptrunner. Below I am able to view the individuals in the initial group, but I am unable to add them to another. Below is currently what I have.
**edit** we are using crowd to manage our groups. These are not local groups.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.bc.user.search.UserSearchService
import com.atlassian.crowd.embedded.api.User
import com.atlassian.jira.user.ApplicationUser
def groupManager = ComponentAccessor.getGroupManager()
def userManager = ComponentAccessor.getUserManager()
def usersInGroup = groupManager.getUsersInGroup("GRC-RefSeq")
log.warn(usersInGroup)
def systems = groupManager.getGroup("Systems")
for(people in usersInGroup){
//lost
}
I've figured it out.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.user.util.UserManager
import com.atlassian.crowd.embedded.api.Group
def groupManager = ComponentAccessor.getGroupManager()
def userManager = ComponentAccessor.getUserManager()
def usersInGroup1 = groupManager.getUsersInGroup("THIS IS GROUP 1")
def usersInGroup2 = groupManager.getUsersInGroup("THIS IS GROUP 2")
log.warn(usersInGroup1)
log.warn(usersInGroup2)
def systems = groupManager.getGroup("ADD TO THIS GROUP")
Collection<ApplicationUser> Group1 = usersInGroup1
Collection<ApplicationUser> Group2 = usersInGroup2
for (ApplicationUser Users1 : Group1){
groupManager.addUserToGroup(Users1,systems)
}
for (ApplicationUser User2 : Group2){
groupManager.addUserToGroup(User2,systems)
}
Hey there!
With Group Master for Jira. You can quickly add, remove, or update members—all from one place with bulk users ;) with UI, no need script anymore :v
Try it out and make group management smooth and simple!
https://marketplace.atlassian.com/apps/1236395/group-master-for-jira?hosting=datacenter&tab=overview
And another advanced group management capabilities:
View group usage across Jira
Edit group names for clarity
Move or copy group members easily
Replicate or migrate group usage
Delete groups and clean up associated data
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.