We have over 1000 Organizations and working on a more reliable way to automate our user management processes.
This is the last segment, before adding users to their correct organization, we need to ensure they are not associated with any other.
Currently working on a script to obtain all organizations and the customers for each, the script will then need look through the Organizations & Customer Map to them remove the user from that organization.
Has anyone done something similar?
I did this (and a bit more) few months ago for a client.
Have you checked the following?
import com.atlassian.servicedesk.api.organization.OrganizationService
import com.atlassian.servicedesk.api.organization.OrganizationsQuery
I cannot share the entire code (because someone paid me for it) :) but let me share the part that removes the users from an organisation.
otherOrganizations.each {organizationToRemoveFromUser ->
def removeUsersParam = organizationService
.newUsersOrganizationUpdateParametersBuilder()
.organization(organizationToRemoveFromUser as CustomerOrganization).users(usersToAdd).build()
organizationService.removeUsersFromOrganization(currentUser, removeUsersParam)
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.