I would like to use JIRA API to bulk rename usernames. I am currently using JIRA 6.3.14 and I am also having the Groovy Plugin installed. I am not able to find any API to help me achieve this. Can someone point me to the right direction. As we are maintaining a big user directory the use of Jira UI for manual update of the username is not an option
Thanks
I found a solution!
Using groovy
ImmutableUser.Builder builder = ImmutableUser.newUser(ApplicationUsers.toDirectoryUser(user)); builder.name(newName); userManager.updateUser(new DelegatingApplicationUser(user.getKey(), builder.toUser()));
Hi,
This may be a dumb question, but how do you use that groovy script?
Thanks,
Mel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
import com.atlassian.jira.user.DelegatingApplicationUser import com.atlassian.crowd.embedded.impl.ImmutableUser import com.atlassian.jira.user.ApplicationUsers import com.atlassian.jira.user.ApplicationUser import com.atlassian.jira.user.util.UserUtil import com.atlassian.jira.user.util.UserManager; import com.atlassian.crowd.embedded.api.User; import com.atlassian.jira.component.ComponentAccessor; UserManager userManager = ComponentAccessor.getUserManager(); ApplicationUser appUser = userManager.getUserByKey("<old_username>"); ImmutableUser.Builder builder = ImmutableUser.newUser(ApplicationUsers.toDirectoryUser(appUser)); builder.name("<new_username>"); userManager.updateUser(new DelegatingApplicationUser(appUser.getKey(), builder.toUser()));
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.