How can i merge (or at least manage) users between jira and confluence
Asked by Jake Bishop:

We have been using confluence and jira for a while now but it has recently been decided that users should be managed from a central place (eg jira as a user provider, or crowd). The problem is: someone had the bright idea to allocate usernames in the format "John Smith" in confluence and "j.smith" in jira.

Now when we try to use jira as the provider john gets 2 user accounts in confluence. He could just start using the new j.smith account, but then his personal space and posts nolonger belong to him. How can i get around this problem?

I have also just installed a trial version of crowd to see if this sorts out my problems (it would also offer SSO). But at first look this seems to cause the same problems.


Answers:
author: Bastiaan Jansen
body: Hi Yakobe,

Changing usernames in the system is currently not supported. We do have some workarounds for this though. Please first perform this in a test environment to make sure that your production data does not get corrupted.

The following page explains how to rename users in Confluence: <https://confluence.atlassian.com/display/DOC/Changing+Usernames>

Based through some SQL queries.

An additional option would be to generate a XML backup of your system. Then unzip the generated zip file and open the "entities.xml" file in a text editor.

Perform a search on the username. You will find entries like these:

*\<!\[CDATA\[bas-test\]\]\>*

In this case I want to rename the user "bas-test" to "admin".  
I performed a replace on all entries which have bas-test and renamed this to admin.

Once done re-zip all the files and perform a xml import. Now the usernames should be changed.  
Both options (SQL and XML) require a lot of manual actions and will be time consuming.

As a side note I need to point out that these changes are not supported by Atlassian support.

comments: author: Jake Bishop
body: The xml solutions actually sounds like it could be one of the easier solutions. Just to check that i have understood: Do I only have to change the one entities.xml file? And do i just perform a search and replace on every username that i want to change in the file or only the values within those CDATA entries?


author: Colin Goudie
body: You need to rename one of the sets of users.

Both JIRA and Confluence don't support it officially but there are SQL scripts etc.. around (search for rename JIra and Confluence users)

Alternatively, in JIRA, try out the groovy script runner plugin. It has the ability to rename users in JIRA.

Once you have both Confluence and JIRA users matching by name, then you can direct Confluence to use JIRA as its source for users and you should be ok.

comments: author: Colin Goudie
body: Also, should mention Yakobe, that we at AppFusions have various SQL scripts for both JIRA and Confluence that may work for you if you want to contact us direct. We don't have every variant but depending on your product version and DBMS we might have some tested ones that would work


author: Jake Bishop
body: hi colin. Thanks for your answer. Are these SQL scripts you mention freely available or paid solutions?


author: Ellen Feaheny [AppFusions]
body: Yakobe -

No they are not freely available since not really plug and go, given environment deltas/specifics at a minimum among other complexities in a merge effort. At least we have not productized yet - its tricky.

Colin's been working on these as part of a very large and hairy merge effort of 2 JIRAs and 2 Confluences, as the result of a corporate acquisition (client company)

If interested in some help, shoot us a mail at [info@appfusions.com](mailto:info@appfusions.com) and we can help you -

System merges are not for the feign of heart, for sure. Tricky business!


Tags: authentication

crowd

jira

user