I've created a Repoinit script using an OSGi Service Factory Configuration. I've successfully deployed the OSGi configuration containing the Repoinit script and I can see it under /system/console/configMgr, but the rep:policy isn't created in the DAM as expected. Can someone please provide guidance?
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0"
xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="sling:OsgiConfig"
repoinit.content='{
"scripts": [
"set ACL for path /content/dam/advisor/ deny jcr:all on granted group everyone",
"set ACL for path /content/dam/advisor/ allow jcr:read on granted group jhi-employee",
]
}'/>
Solved! Go to Solution.
Views
Replies
Total Likes
This was the correct syntax after some more testing (in AEM 6.5.18):
scripts=["
set ACL for employee
allow jcr:read on /content/dam/advisor
end
"]
what is the error you are getting?
did you add all dependencies in POM ?
<dependencies>
<!-- Apache Sling Repository Initialization -->
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.jcr.repoinit</artifactId>
<version>1.1.46</version>
</dependency>
<!-- Apache Sling JCR API -->
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.jcr.api</artifactId>
<version>2.4.0</version>
</dependency>
<!-- Apache Sling RepoInit Parser -->
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.repoinit.parser</artifactId>
<version>1.6.4</version>
</dependency>
</dependencies>
You need to explicitly create the folders on which you are setting the ACLs
repoinit
statements to the script property of the config. The syntax and options are documented in Sling documentation. There should be explicit creation of a parent folder before their child folders. For example, an explicit creation of /content
before /content/myfolder
, before /content/myfolder/mysubfolder
. For ACLs being set on low-level structures, it is recommended to set them on a higher level and work with a rep:glob
restriction. For example, (allow jcr:read on /apps restriction(rep:glob,/msm/wcm/rolloutconfigs))
.and if you are working on aem cloud your repoint file should be in json formats. A sample repoinit file is always created if you create a project based on new maven archetype
try this:
{
"scripts": [
"create path /content/dam/advisor",
"set ACL for everyone\n\tdeny jcr:all on /content/dam/advisor\nend",
"set ACL for jhi-employee\n\tallow jcr:read on /content/dam/advisor\nend"
]
}
Thanks Anish.
This was the correct syntax after some more testing (in AEM 6.5.18):
scripts=["
set ACL for employee
allow jcr:read on /content/dam/advisor
end
"]
@stiegjo22 Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.
Views
Replies
Total Likes