Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Adobe Experience Manager’s Sling RepoInit: When Should You Use It? | AEM Community Blog Seeding




Adobe Experience Manager’s Sling RepoInit: When Should You Use It? by Poorva Jain


We’re back to discuss when and how to use Sling Repolnit! Wondering what this tool is? Check out our post on the "what" and "why" behind it before diving into the below use cases.

As a note, for the purposes of this article, all examples for RepoInit are syntax agnostic. This is because a RepoInit configuration can either be in a .cfg.json format or .xml format. So say, if you are doing this in .xml you will have to use "
" for a new-line character while /n would work just fine in case of a .cfg.json. If you want a quick refresher, look back to this post!

Use Case One: Permission Modelling
You can create users and groups, assign group membership, assign privileges and even add glob restrictions via repo init. If you have used ACL packages or any other third-party packages for performing these operations earlier, this should be a refreshing change!

create path /home/groups/my-demo-site(rep:AuthorizableFolder)
create group Demo_Site_Users with path /home/groups/my-demo-site
set ACL for Demo_Site_Users
allow jcr:read on /content/my-demo-site restriction(rep:glob,/jcr:primaryType)
set ACL for Demo_Site_Users
allow jcr:read on /content/my-demo-site restriction(rep:glob,/:childOrder)

create path /content/my-demo-site/language-masters/en(cq:Page)
create path /content/my-demo-site/language-masters/en/jcr:content(cq:PageContent)
set properties on /content/my-demo-site/language-masters/en/jcr:content
set sling:resourceType{String} to foundation/components/redirect
set sling:redirectStatus{Long} to 302
set sling:redirect{Boolean} to true
set jcr:title{String} to \"My Demo Site\"
set hideInNav{Boolean} to true
set noCrawling{Boolean} to true
set excludeFromSiteSearch{Boolean} to true
set cq:template{String} to /conf/my-demo-site/settings/wcm/templates/redirectpage
create group Demo_Site_SubGroup with path /home/groups/my-demo-site
add Demo_Site_SubGroup to group Demo_Site_Users
set ACL for Demo_Site_SubGroup
allow jcr:read,jcr:modifyProperties,jcr:addChildNodes,rep:write,crx:replicate,
jcr:removeNode,jcr:removeChildNodes,jcr:lockManagement,jcr:versionManagement,jcr:nodeTypeManagement on /content/my-demo-site/language-masters/en

Read Full Blog

Adobe Experience Manager’s Sling RepoInit: When Should You Use It?


Please use this thread to ask the related questions.

Kautuk Sahni
0 Replies