Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

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

kautuk_sahni
Employee
Employee

BlogImage.jpg

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

Abstract

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)
end
set ACL for Demo_Site_Users
allow jcr:read on /content/my-demo-site restriction(rep:glob,/:childOrder)
end

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
end
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
end

Read Full Blog

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

Q&A

Please use this thread to ask the related questions.

0 Replies