Combining two different users
Asked by Jessica Foo:

Hi Everyone,

So currently, we have two confluences and are in the process of merging both of them. It's simple enough by doing the full backup of confluence A then importing the spaces individually from confluence B. However, what we've found is that our main problem lies within the users.

what would be the best way to merge users from both confluences? On confluence A, the users are managed by crowd but on confluence B the users are managed by the confluence user directory. Additionally, the user name conventions are not the same across both. - We are well aware that there may be two user accounts for one user as a result. We're just wondering what the best way would be to go about this.

Additionally, we're just wondering if confluence will recognize a user import and matchup the user names respectively. I.e. on a page it says last modified by unknown user: (Jane Doe), would this automatically refresh itself, once we imported Jane Doe's credentials? Or do we need to import the users first and the spaces last?

Many thanks everyone. :)


Answers:
author: Jessica Foo
body: Hi Deividi,

Thanks so much for your reply,

I believe my confluence version is 5.2 :)


author: Giuliano C.
body: Since Confluence 5.2.3 we have started to use the \*cwd_mapping\* table which identifies the users with hashes instead of only the username. In older version of Confluence, the data/ramification would only "depend" of the username.

To do it, we need to track which hash is being used and modify it according to the output. Basically, what we would need to follow by standard procedures:

1) First, find the user key (hash) inside the user_mapping table:

```
select * from user_mapping;
```

2) Then, check for which directory ID comes the user

```
select * from cwd_user;
```

3) Then, identify from which directory the user is inside, since we have only found the ID in the query above

```
select * from cwd_directory;
```

After getting all the content, we would need to update the username user_key to use the one from the user that you're looking for. PS: **Always remember to do a backup of the database.**

Cheers,

Giu


author: Alexey_Rjeutski__Polontech_
body: I would recommend to make the usernames to be matched before the migration if you don't want to make post-merge work with the database. You should prepare the mapping list and then one of the options is to change usernames in the source confluence one by one (see [](https://confluence.atlassian.com/display/DOC/Changing+Usernames)<https://confluence.atlassian.com/display/DOC/Changing+Usernames>) but that depends on confluence version you have.

The other option (if you have thousands of usernames) is to export your site with xml (or make database dump) and then make the change with automate script that will find the matches - but you should examine that dump carefully. As the example script please find [](https://confluence.atlassian.com/display/CONF35/Changing+Usernames)<https://confluence.atlassian.com/display/CONF35/Changing+Usernames>d but please note that script I provided is for confluence 3.5 and can differ for other versions of confluence.


author: Deividi Luvison
body: Hey Jessica,

Firstly let me start replying your questions:

* What would be the best way to merge users from both confluences?

There is a method we can try, however it involves database manipulation and some testing in your end.

* Additionally, we're just wondering if confluence will recognize a user import and matchup the user names respectively. I.e. on a page it says last modified by unknown user: (Jane Doe), would this automatically refresh itself, once we imported Jane Doe's credentials? Or do we need to import the users first and the spaces last?

By default, nope, confluence will not refresh things automaticaly, however depending on the version you are that might be possible.

Let me know your Confluence version and depending on that I might be able to provide you a work around to achieve that end :).  
Thanks and Regards,  
David\|Confluence Support Engineer

<br />


Tags: confluence-administration