I was able to find a lot of ways to manipulate users using groovy in Jira but can't find similar for Confluence.
Does anyone know how to rename or update user in Confluence?
For example Jira ones:
https://community.atlassian.com/t5/Jira-questions/How-to-bulk-rename-username/qaq-p/216275
Figured out something like:
import com.atlassian.user.UserManager
import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.confluence.user.UserAccessor
def userManager = ComponentLocator.getComponent(UserManager)
def userAccessor = ComponentLocator.getComponent(UserAccessor)
def users = userManager.users
users.each { uu ->
if ( uu.getName().contains("something") ) {
userAccessor.renameUser(userAccessor.getUserByName(uu.getName()), uu.getName().replace("something", "something else"))
}
}
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.