AEM Instance migration  is common in real world , Package manager does help when you want to move users and groups privileges from one AEM instance to another.

User Migration Steps :

  1. Go to package manager
  2. Create a package for user migration and add below filters and rules.
    • Add filter :  /home/users
    • Exclude Tokens : AEM implemented user token based authentication , all tokens will be stored under appropriate user node as rep:token node type.So we have to exclude tokens from package otherwise CRX will not allow to install package and throws javax.jcr.nodetype.ConstraintViolationException Exception.
    • Exclude Admin & Anonymous users : CRX doesn’t allow to move or delete admin users,As these users has lockable node property hence cannot be copied on destination instance.
    • Add rep:policy : All  Users ,resource based permissions will be stored in rep:policy nodes ,So add root rep:policy user permission node to package.migration
    1. Click save.
    2. Build the package and download.
  3. Unzip the package and open META-INF/vault/filter.xml in a text editor
    Add mode=”merge” to the filter tag, for example:

    <?xml version="1.0" encoding="UTF-8"?>
    <workspaceFilter version="1.0">
    <filter root="/home/users" mode="merge">
    <exclude pattern="/home/users/a/admin"/>
    <exclude pattern="/home/users/a/anonymous"/>
    </filter>
    </workspaceFilter>
    
  4. re-zip the package and install in new AEM instance .