Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

User mapping while migrating Confluence spaces (export / import) - how?

Hi community, 

I hope you can help me.

I need to migrate several Confluence Spaces from Confluence Server 6.10.1 to another Confluence Server instance (version unknown yet, but not older than 6.10.1).

The usernames (and certainly also the user IDs) will be different between source and target side.

What is the best way to migrate the spaces and map the users correctly? We thought about soing search-and-replace in the exported XML before importing, but there are users referenced in a mixed way sometimes with their email addresses (which are the usernames on source instance) and sime kind of ID or hash.

<object class="ConfluenceUserImpl" package="com.atlassian.confluence.user">
<id name="key"><![CDATA[ff80818169286c7e016a11f1d2f5000a]]></id>
<property name="name"><![CDATA[john.doe@example.com]]></property>
<property name="lowerName"><![CDATA[john.doe@example.com]]></property>
</object>

Do I have to evaluate these objects like the above one, in order to find out the mapping between username and key, so I can replace all the keys accordingly in objects like the below one, where only keys are used?


<object class="User2ContentRelationEntity" package="com.atlassian.confluence.internal.relations.dao">
<id name="id">1345102</id>
<property name="targetContent" class="Page" package="com.atlassian.confluence.pages"><id name="id">984062</id>
</property>
<property name="sourceContent" class="ConfluenceUserImpl" package="com.atlassian.confluence.user"><id name="key"><![CDATA[ff80818164dabce30164eebfbe150004]]></id>
</property>
<property name="targetType" enum-class="RelatableEntityTypeEnum" package="com.atlassian.confluence.internal.relations">PAGE</property>
<property name="relationName"><![CDATA[collaborator]]></property>
<property name="creationDate">2018-09-24 10:39:18.000</property>
<property name="lastModificationDate">2018-09-24 10:39:18.000</property>
<property name="creator" class="ConfluenceUserImpl" package="com.atlassian.confluence.user"><id name="key"><![CDATA[ff80818164dabce30164eebfbe150004]]></id>
</property>
<property name="lastModifier" class="ConfluenceUserImpl" package="com.atlassian.confluence.user"><id name="key"><![CDATA[ff80818164dabce30164eebfbe150004]]></id>
</property>
</object>

If that's the case, is there any tool that can help with this task?

Thank you!

Daniel

1 answer

0 votes
Diego Atlassian Team Nov 14, 2019

Hello there, @Daniel ! Migrating users can be a tough procedure to complete, but it can be done.

First, there are a few things we need to clarify before. Here we go:

  • Space XML exports do not contain users, at all
  • The full site export to XML does contain the users
  • Restoring a full site XML will overwrite the entire destination instance
  • You could recreate all the users from the original instance into your destination via SQL. We strongly advise against this.

Crowd does have enough power to import and export users at will. Here is our documentation on this for Crowd:

 

Confluence does not have this functionality (export user data as CSV). But we do have a database workaround that might help:

You could also make use of a third-party addon that does export users to CSV. Here, take a look, Daniel:

 

However, if your aim is to simply migrate content (pages, spaces, and users) from one instance into another, you can use the full site XML export. This, however, will erase all content that already exists in the destination Confluence.

Here is how we do it:

  1. Go to the original instance
  2. Click the Cog icon at the top right corner
  3. Select General Configuration
  4. Search for Backup & Restore at the left side menu bar
  5. Under Export this site click the Export button   BackupRestoreUsers.jpg
  6. Now, go to your Home Diretory
  7. Go into the backups folder
  8. Grab the XML file from there
  9. Go to the destination Confluence
  10. Click the Cog icon at the top right corner
  11. Select General Configuration
  12. Search for Backup & Restore at the left side menu bar
  13. Now we can select between uploading a file or restoring the XML from the Home Directory
  14. Select to restore from home directory if your XML exceeds 1GB
  15. Import the XML

To find your home folder, you can do the following:

  1. Click the Cog Icon at the top right corner
  2. Select General Configuration
  3. Search for System Information in the left side menu bar
  4. Search for Confluence Home
  5. You will see the path to your home folder there

 

The process above will restore all the content from the original instance into the destination instance. However, everything in the destination will be erased and replaced with the XML data.

Here is the warning from within Confluence:

Anotação 2019-11-14 164503.jpg

 

Also, here is our documentation on content import and export for Confluence:

 

I hope this shine some light at your situation, Daniel. Looking forward to your reply!

Thank you @Diego for the eloquent answer.

Users will be migrated on another level (from Crowd to an Active Directory), but user names will be modified in that step (currently we have email addresses as user names, they will be changed to cryptic strings). Maybe we even need to rename the users before migrating them into the new instance. Let's use this as the most probably scenario:

My questions only concerns the mapping of user names inside Confluence content (and also Jira content in another step). 

Only users mentioned in the Confluence backup XML (or Jira backup XML) need to be mapped in this step. Not all user names in our system. So it doesn't matter that not all user data is contained in the backup XMLs of Confluence and Jira.

Okay, let's assume, we have current user john.doe@example.com, who will be named "ABC123" in the target environment.

Do you think, we'll be safe going the following route?:

1. Rename the user in current Crowd from  john.doe@example.com to ABC123

2. Sync all directories

3. Backup Confluence space.

4. Migrate users to target environment (Crowd > AD)

5. Sync all directories on target environment

6. Import Confluence space XML on target environment

Will the users be mapped correctly then? On the target environment, there already exist other users, so user keys (those which are internally used) will not be the same on source and target environment. So mathing can only be done via user name. Will this work?

 

In case it won't work as described above:

Is it correct, that in the Confluence XML I need to parse all the objects like this:

<object class="ConfluenceUserImpl" package="com.atlassian.confluence.user">
<id name="key"><![CDATA[ff80818169286c7e016a11f1d2f5000a]]></id>
<property name="name"><![CDATA[ABC123]]></property>
<property name="lowerName"><![CDATA[ABC123]]></property>
</object>

...to create a table with users name / key mappings like this:

User name | source env. user key

ABC123 | ff80818169286c7e016a11f1d2f5000a 

Then, on target side, after XML import, we generate a similar table that will have different keys for each user name and then we merge the tables like this:

User name | source env. user key | target env. user key

ABC123 | ff80818169286c7e016a11f1d2f5000a | DIFFERENTKEYhisadhoiasudh982

And then, we can do a search-and-replace in the Space XML, replacing the old key with the new one, then re-import the XML.

 

And: Is it the same with Jira?

Thank you,

Daniel

@Daniel - Were you able to figure out how to map the users? If you did, did you use a special program for the find and replace or did you script something internally?

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

What do you think is the most *delightful* Confluence feature? Comment for a prize!

- Create your own custom emoji 🔥 - "Shake for Feedback" on mobile 📱 - An endless supply of GIFs via GIPHY 🤩 Is there anything quite as nice as a pleasant surprise? Comment below with what...

342 views 23 8
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you