How can I change a user's "user_name"??

jOhn Simonson February 2, 2012

Unfortunately, our company uses an employee's <first-inital><surname> as the username (e.g. jsmith). Since we use LDAP to validate credentials in JIRA, this is also being used as the JIRA username (cwd_user.user_name).

Now just imagine, somebody gets married and changes their name (jsmith becomes jjones). The company does not have too much of a problem, but boy does JIRA have one. Since this user_name is being used as a foreign key in umpteen other tables (jiraissue.REPORTER, jiraissue.ASSIGNEE, ..., ..., ...) instead of the cwd_user.ID, then changing the poor newly-wed's name is a virtual impossibility.
NOTE: this is not the "display_name" or "email_address" - changing those is of course easy; however, it should be just as easy to change the other "names" and "lower_names" in cwd_user (first, last, user, display).

Even worse, until I manage to change it in JIRA, he/she is unable to login (since his/her LDAP credentials are unknown to JIRA).

I remember reading a discussion about this last year. Unfortunately, their solution was a long series of handwritten scripts, updating effected tables. But what I also remember about the conversation was that it ended sometime in 2010, and that not a few times the entries were "... oh and I forgot about table so-and-so ,,,". In the meantime, I am sure that many changes have been made to the JIRA database design, so even more necessary update locations could fall through the cracks.

I had this problem on a much larger scale a few months ago, when the company changed from a neutral personnel number as LDAP username to the new format. To handle that, I made an XML backup of JIRA and essentially edited all occurances for each user. I do not want to have to do that now (involves downtime) every time someone gets married!

Does Atlassian have a supported means for performing this trivial task, or are there any gurus out there willing to take a chance and give me some help?

We are using MS SQL Server 2008 in production, MS SQL Server 2005 in an evaluation sandbox.

Cheers, John.

10 answers

1 accepted

4 votes
Answer accepted
Mark Symons
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 2, 2012

The ability to rename a user is logged here:

https://jira.atlassian.com/browse/JRA-1549?

In this issue, Atlassian said "unlikely in next 12 months". This was in June 2011.

One solution is to use the script-runner plugin that has a canned script for renaming users:

https://plugins.atlassian.com/plugin/details/6820

jOhn Simonson February 2, 2012

Thanks, that is the discussion I was refering to.
Opened in 2003, and STILL not resoved.

I will look into the Script Runner - maybe there is something there worth investigating.

cioa - john.

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 2, 2012

I hope there is something worth investigating... writing that code was a lot of work.

The other alternatives are using raw sql or editing the backup xml. Both require substantial downtime and are risky, and incomplete as they won't update saved filter values. The script runner method doesn;t require downtime, although ideally you should test on a copy of production.

Sean Rich February 2, 2012

I used the Script Runner plugin to do this a few months ago and it worked beautifully.

P.S. Thank you, Jamie.

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 2, 2012

No problem, thanks Sean ;-)

1 vote
rmk May 6, 2013

Hi All,

The ability to edit a username has been added to the next release of JIRA - 6.0!

JIRA 6.0 will be released in a few weeks time!

Cheers,

Roy Krishna
JIRA Product Management

So, the JIRA 6 documentation claims you can change usernames. The documentation is frustratingly poor. It's the only item on the Managing Users page (https://confluence.atlassian.com/display/JIRA/Managing+Users#ManagingUsers-Changingauser'snameoremailaddress) that doesn't actually tell you how to do it, it just says to use the "JIRA Internal Directory"

Wading through the docs once more reveals how to configure User Directories, which seems to be another name or subset of Internal Directories (https://confluence.atlassian.com/display/JIRA/Configuring+User+Directories). It states:

To configure your user directories:

  1. Log in as a user with the 'JIRA Administrators' global permission.
  2. Choose the cog icon at top right of the screen, then choose User Management > User Directories.

However, when I do so, There is no "User Directories" option. And I am a Jira Administrator. What gives? Is it because we're hosted? And if so, how many chickens to I have to sacrifice to do something as absurdly simple as changing a username?

0 votes
vu chinh November 4, 2013

this is good answer. i love it

0 votes
vu chinh October 31, 2013

good answer

0 votes
vu chinh October 31, 2013

this is good question, you can bvm,

0 votes
vu chinh October 22, 2013

useful question.

0 votes
vu chinh October 22, 2013

this great answer

0 votes
Mohammed Rashid July 16, 2013

If you are hosted, you can use Groovy runner script or you can do a database update of few tables.

I have performed this activity for JIRA and Confluence and worked as expected.

You need run update query on few tables.

vu chinh October 22, 2013

great answer.

vu chinh October 23, 2013

thanks for your solution.

0 votes

If you're using the hosted version, and want to change the username (as opposed to the display name), you're out of luck - you have to create a new user, change permissions on your workflow to allow you to migrate issues, migrate all issues/projects/etc. to the new user, and delete the old user. You can find more info here: https://confluence.atlassian.com/pages/viewpage.action?pageId=298979005

I believe there are more complecated solutions that involve exporting/altering/importing your database, but Atlassian, though documenting them, does not support them.

0 votes
nieca June 18, 2013

How can I exactly do this? Is there a magic "rename" button or smth? I don't want to deal with "directories" - I only want to change user name...

Suggest an answer

Log in or Sign up to answer