Create System User using Repository Initializer(RepoInit) in AEM as a Cloud service

 



Repo Init is a set of instructions/scripts which help us in creating JCR structures, service users and groups. There are no explicit permissions needed in order to run these scripts. These scripts are executed early in the deployment process so that all required configuration/content exist in the system before the code is executed.

Steps to create system user:

  •  Go to system console config manager and search for Apache Sling Repository Initializer Factory and create a new OSGI config.
  • Add the below script in scripts and then the system user will be created in your AEM
        Note : add any name to your system user and permission as per your needs.
           create service user your-systemuser-name 
                set ACL on /conf, /etc   
                allow jcr:read for your-systemuser-name
            end
  • Now in order to commit the same, copy the PID and open OSGI Installer Configuration Printer.
  • Add your PID and select the serialization format  and click on print. Copy serialized configuration properties and remove the references.
  • Create an OSGi config with: org.apache.sling.jcr.repoinit.RepositoryInitializer-project.config and add the copied the content.
Deploy the code and you will get your system user created on your system.

Reference:



Hope this helps!!

Happy Coding 🙏


If you like my post and find it helpful, you can buy me a coffee.

Comments

Post a Comment