Class CoreRepositorySetupService
- java.lang.Object
-
- com.composum.sling.core.service.impl.CoreRepositorySetupService
-
- All Implemented Interfaces:
RepositorySetupService
public class CoreRepositorySetupService extends Object implements RepositorySetupService
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
CoreRepositorySetupService.Tracker
-
Field Summary
Fields Modifier and Type Field Description static ThreadLocal<CoreRepositorySetupService.Tracker>
TRACKER
-
Fields inherited from interface com.composum.sling.core.service.RepositorySetupService
GROUP_PATH, MEMBER_OF, USER_PATH
-
-
Constructor Summary
Constructors Constructor Description CoreRepositorySetupService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addAcList(@NotNull javax.jcr.Session session, @NotNull String path, @NotNull List<Map<String,Object>> list)
protected void
addAclObject(@NotNull javax.jcr.Session session, @NotNull com.google.gson.stream.JsonReader reader)
protected void
addAcRule(@NotNull javax.jcr.Session session, @NotNull String path, @NotNull String principalName, boolean allow, @NotNull String[] privilegeKeys, @NotNull Map<String,Object> restrictionKeys)
void
addJsonAcl(@NotNull javax.jcr.Session session, @NotNull Reader reader, @Nullable Map<String,Object> values)
void
addJsonAcl(@NotNull javax.jcr.Session session, @NotNull String jsonFilePath, @Nullable Map<String,Object> values)
adds ACL accordiong to rules declared as JSON file; e.g.protected void
error(String pattern, Object... args)
protected void
info(String pattern, Object... args)
protected org.apache.jackrabbit.api.security.user.Authorizable
makeGroupAvailable(@NotNull javax.jcr.Session session, @NotNull String id, @NotNull String intermediatePath)
protected void
makeMemberAvailable(@NotNull javax.jcr.Session session, @NotNull String memberId, @NotNull List<String> groupIds, @Nullable String groupPath)
protected javax.jcr.Node
makeNodeAvailable(@NotNull javax.jcr.Session session, @NotNull String path, @NotNull String primaryType)
protected org.apache.jackrabbit.api.security.user.Authorizable
makeUserAvailable(@NotNull javax.jcr.Session session, @NotNull String id, @NotNull String intermediatePath)
protected void
removeAcList(@NotNull javax.jcr.Session session, @NotNull String path, @NotNull List<Map<String,Object>> list)
protected void
removeAclObject(@NotNull javax.jcr.Session session, @NotNull com.google.gson.stream.JsonReader reader)
protected void
removeAcRule(@NotNull javax.jcr.Session session, @NotNull String path, @Nullable String principal)
protected void
removeGroup(@NotNull javax.jcr.Session session, @NotNull String id)
void
removeJsonAcl(@NotNull javax.jcr.Session session, @NotNull Reader reader, @Nullable Map<String,Object> values)
void
removeJsonAcl(@NotNull javax.jcr.Session session, @NotNull String jsonFilePath, @Nullable Map<String,Object> values)
revert all changes made by 'addJsonAcl'...protected void
removeMember(@NotNull javax.jcr.Session session, @NotNull String memberId, @NotNull List<String> groupIds)
protected void
removeNode(@NotNull javax.jcr.Session session, @NotNull String path)
protected void
warn(String pattern, Object... args)
-
-
-
Field Detail
-
TRACKER
public static final ThreadLocal<CoreRepositorySetupService.Tracker> TRACKER
-
-
Method Detail
-
addJsonAcl
public void addJsonAcl(@NotNull @NotNull javax.jcr.Session session, @NotNull @NotNull String jsonFilePath, @Nullable @Nullable Map<String,Object> values) throws javax.jcr.RepositoryException, IOException
Description copied from interface:RepositorySetupService
adds ACL accordiong to rules declared as JSON file; e.g.- allow read for 'everyone' on root ('/') to walk trough (this node only)
- deny read for 'a-group' on '/apps' and all subnodes and ensure that this folder and the group exists
- make 'everyone' and 'someone' a member of 'a-group' (both principals must exist)
- remove each ACL for 'a-group' from '/conf' and ensure that this group exists
- Specified by:
addJsonAcl
in interfaceRepositorySetupService
- Parameters:
session
- the session (not resolver to make it easy usable in install hooks)jsonFilePath
- a repository path to the ACL JSON file- Throws:
javax.jcr.RepositoryException
IOException
-
addJsonAcl
public void addJsonAcl(@NotNull @NotNull javax.jcr.Session session, @NotNull @NotNull Reader reader, @Nullable @Nullable Map<String,Object> values) throws javax.jcr.RepositoryException, IOException
- Specified by:
addJsonAcl
in interfaceRepositorySetupService
- Throws:
javax.jcr.RepositoryException
IOException
-
removeJsonAcl
public void removeJsonAcl(@NotNull @NotNull javax.jcr.Session session, @NotNull @NotNull String jsonFilePath, @Nullable @Nullable Map<String,Object> values) throws javax.jcr.RepositoryException, IOException
Description copied from interface:RepositorySetupService
revert all changes made by 'addJsonAcl'... - use the same configuration file- Specified by:
removeJsonAcl
in interfaceRepositorySetupService
- Throws:
javax.jcr.RepositoryException
IOException
-
removeJsonAcl
public void removeJsonAcl(@NotNull @NotNull javax.jcr.Session session, @NotNull @NotNull Reader reader, @Nullable @Nullable Map<String,Object> values) throws javax.jcr.RepositoryException, IOException
- Specified by:
removeJsonAcl
in interfaceRepositorySetupService
- Throws:
javax.jcr.RepositoryException
IOException
-
addAclObject
protected void addAclObject(@NotNull @NotNull javax.jcr.Session session, @NotNull @NotNull com.google.gson.stream.JsonReader reader) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
removeAclObject
protected void removeAclObject(@NotNull @NotNull javax.jcr.Session session, @NotNull @NotNull com.google.gson.stream.JsonReader reader) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
addAcList
protected void addAcList(@NotNull @NotNull javax.jcr.Session session, @NotNull @NotNull String path, @NotNull @NotNull List<Map<String,Object>> list) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
removeAcList
protected void removeAcList(@NotNull @NotNull javax.jcr.Session session, @NotNull @NotNull String path, @NotNull @NotNull List<Map<String,Object>> list) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
addAcRule
protected void addAcRule(@NotNull @NotNull javax.jcr.Session session, @NotNull @NotNull String path, @NotNull @NotNull String principalName, boolean allow, @NotNull @NotNull String[] privilegeKeys, @NotNull @NotNull Map<String,Object> restrictionKeys) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
removeAcRule
protected void removeAcRule(@NotNull @NotNull javax.jcr.Session session, @NotNull @NotNull String path, @Nullable @Nullable String principal) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
makeNodeAvailable
protected javax.jcr.Node makeNodeAvailable(@NotNull @NotNull javax.jcr.Session session, @NotNull @NotNull String path, @NotNull @NotNull String primaryType) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
removeNode
protected void removeNode(@NotNull @NotNull javax.jcr.Session session, @NotNull @NotNull String path) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
makeUserAvailable
protected org.apache.jackrabbit.api.security.user.Authorizable makeUserAvailable(@NotNull @NotNull javax.jcr.Session session, @NotNull @NotNull String id, @NotNull @NotNull String intermediatePath) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
makeGroupAvailable
protected org.apache.jackrabbit.api.security.user.Authorizable makeGroupAvailable(@NotNull @NotNull javax.jcr.Session session, @NotNull @NotNull String id, @NotNull @NotNull String intermediatePath) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
removeGroup
protected void removeGroup(@NotNull @NotNull javax.jcr.Session session, @NotNull @NotNull String id) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
makeMemberAvailable
protected void makeMemberAvailable(@NotNull @NotNull javax.jcr.Session session, @NotNull @NotNull String memberId, @NotNull @NotNull List<String> groupIds, @Nullable @Nullable String groupPath) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
removeMember
protected void removeMember(@NotNull @NotNull javax.jcr.Session session, @NotNull @NotNull String memberId, @NotNull @NotNull List<String> groupIds) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
-