How to merge users in Confluence?

Taylor Zavala October 3, 2013

Last night some users were re-named in AD so now the user has two accounts within the user directory (Microsoft AD read only, with Local Groups) in Confluence 4.3.5. Is there a way to merge the old account with the new account? For example, bphillips was renamed to brucephillips in AD. Now, both accounts exist in Confluence's user directory. I would like all the old content associated with the bphillips user to be associated with brucephillips.

5 answers

1 accepted

1 vote
Answer accepted
J. Caldwell
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.
October 3, 2013

Take a look at this plugin:

https://marketplace.atlassian.com/plugins/com.onresolve.confluence.scripting.script-runner

It is fantastic for Jira, I haven't used it for Confluence before. The rename a user functionality has the option to merge them into another.

Gonchik Tsymzhitov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 18, 2014

I tried but is not work on the Confluence 5.4.3

3 votes
Esther Wien June 14, 2015

The following is a re-name and migrate method we use for Confluence and JIRA:

Let's say you have a user with the username 'alice' in your local directory. Now you add an LDAP which contains a NEW user 'bob' and you want to migrate alice to bob. Follow these steps:

1. Make sure your local directory has priority over the LDAP. (local dir is positioned above the LDAP in the 'User Directories' admin screen)

2. rename 'alice' to 'bob'

3. Move LDAP to have priority over your local directory.

Result: The new 'bob' has taken over all the content of the user previously known as 'alice'.

 

This method has been tested when migrating from Local to AD and from AD to another AD.

Warning: This only works when migrating content to a new user. So far I have not yet been able to merge two existing (active) users with this method. I tested this and it results in the content of the 'lower priority'-user to be of 'Unknown User'.

Maximilian Klingmann December 14, 2017

By far the best answer here!

Used this exact method to merge users from remote LDAP to Crowd.

1. Users were in Confluence via LDAP Directory

2. Added User with same username in Crowd

3. Connected Crowd with Confluence

4. Set LDAP Directory as first prio

5. Synchronized Crowd Users

6. Tested Crowd User Login (dry-run in "User Directories")

7. Moved Crowd to first prio

8. Disabled LDAP

9. Changed Username in Crowd to E-Mail (since we wanted email to be login from now on)

10. Synchronized Crowd Directory again

9. Dance in Joy, as everything the LDAP user edited is now shown to be edited by the Crowd User!

1 vote
Tobias Montagna-Hay June 15, 2015

I used the SQL commands here to migrate a users activity and content to another user:

https://gist.github.com/tobiasmh/3e5aa4f7a37d9e834647

Esther Wien June 15, 2015

Cool, thanks! I had a hard time figuring out where the username was used to register activity. This cleared things up. :)

Nicolas Esteves October 16, 2015

Hello Tobias, Thank you for the link! This would be useful. Did you get some feedbacks about those queries? On which version did you try them? Regards, Nicolas.

Tobias Montagna-Hay October 21, 2015

I ran these on a production Confluence instance running 5.8.4

Nicolas Esteves October 21, 2015

Thank you for your answer.

Nicolas Esteves October 22, 2015

Hello Tobias, In order to avoid some duplicates in the database (and in the user management administration in Confluence), here are some additional queries: delete from cwd_user_attribute where user_id='28311553'; delete from cwd_membership where child_user_id='28311553'; delete from cwd_user where id ='28311553'; Where "28311553" is the ID of the "old" user in the database. Then, this query (provided by Atlassian in this ticket https://jira.atlassian.com/browse/CONF-30050) helped me to clean everything that needed to be cleaned : DELETE FROM CONTENT WHERE contentid IN (select * from (SELECT DISTINCT c1.contentid FROM CONTENT c1 JOIN CONTENT c2 ON c1.username = c2.username WHERE c1.contenttype = 'USERINFO' AND c2.contenttype = 'USERINFO' AND c1.prevver is null AND c2.prevver is null AND c1.contentid > c2.contentid) as tmp); Note: For MySQL. Nicolas.

0 votes
Patrick Richert April 1, 2015

And now with recent upgrades, the script runner plugin no longer has merge capabilities.  How can we merge user names?

0 votes
Davin Studer
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.
October 3, 2013

5.3 added the ability to change a user's username, but merging after the fact ... dunno.

Gonchik Tsymzhitov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 18, 2014

Did you resolved this issue?

Justin Leader
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.
December 18, 2014

nope

Gonchik Tsymzhitov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 18, 2014

Why?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events