This is an automated email from the ASF dual-hosted git repository.

joerghoh pushed a commit to branch SLING-12642-cache-privileges
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 155411cf87a479e96093f86180c420602fa1ad68
Author: Joerg Hoh <[email protected]>
AuthorDate: Mon Feb 10 15:50:30 2025 +0100

    renanme the class
---
 .../apache/sling/jcr/repoinit/impl/AclUtil.java    | 130 ++++++++++-----------
 .../apache/sling/jcr/repoinit/impl/AclVisitor.java |  22 ++--
 ...sionWrapper.java => CachingSessionWrapper.java} |   4 +-
 .../sling/jcr/repoinit/PrincipalBasedAclTest.java  |   4 +-
 .../sling/jcr/repoinit/impl/AclUtilTest.java       |   4 +-
 .../jcr/repoinit/impl/ManyServiceUsersTest.java    |   2 +-
 6 files changed, 83 insertions(+), 83 deletions(-)

diff --git a/src/main/java/org/apache/sling/jcr/repoinit/impl/AclUtil.java 
b/src/main/java/org/apache/sling/jcr/repoinit/impl/AclUtil.java
index e5f5ab9..98d181c 100644
--- a/src/main/java/org/apache/sling/jcr/repoinit/impl/AclUtil.java
+++ b/src/main/java/org/apache/sling/jcr/repoinit/impl/AclUtil.java
@@ -132,13 +132,13 @@ public class AclUtil {
     }
 
     public static void setAcl(
-            PrivilegeCachingSessionWrapper pcsw, List<String> principals, 
List<String> paths, List<String> privileges, boolean isAllow)
+            CachingSessionWrapper csw, List<String> principals, List<String> 
paths, List<String> privileges, boolean isAllow)
             throws RepositoryException {
-        setAcl(pcsw, principals, paths, privileges, isAllow, 
Collections.emptyList(), Collections.emptyList());
+        setAcl(csw, principals, paths, privileges, isAllow, 
Collections.emptyList(), Collections.emptyList());
     }
 
     public static void setAcl(
-            PrivilegeCachingSessionWrapper pcsw,
+            CachingSessionWrapper csw,
             List<String> principals,
             List<String> paths,
             List<String> privileges,
@@ -147,16 +147,16 @@ public class AclUtil {
             List<String> options)
             throws RepositoryException {
 
-        for (String jcrPath : getJcrPaths(pcsw.getSession(), paths)) {
-            if (jcrPath != null && !pcsw.getSession().nodeExists(jcrPath)) {
+        for (String jcrPath : getJcrPaths(csw.getSession(), paths)) {
+            if (jcrPath != null && !csw.getSession().nodeExists(jcrPath)) {
                 throw new PathNotFoundException("Cannot set ACL on 
non-existent path " + jcrPath);
             }
-            setAcl(pcsw, principals, jcrPath, privileges, isAllow, 
restrictionClauses, options);
+            setAcl(csw, principals, jcrPath, privileges, isAllow, 
restrictionClauses, options);
         }
     }
 
     private static void setAcl(
-            PrivilegeCachingSessionWrapper pcsw,
+            CachingSessionWrapper csw,
             List<String> principals,
             String jcrPath,
             List<String> privileges,
@@ -165,15 +165,15 @@ public class AclUtil {
             List<String> options)
             throws RepositoryException {
 
-        AccessControlManager acMgr = pcsw.getAccessControlManager();
+        AccessControlManager acMgr = csw.getAccessControlManager();
 
         final String[] privArray = privileges.toArray(new 
String[privileges.size()]);
-        final Privilege[] jcrPriv = pcsw.privilegesFromNames(privArray);
+        final Privilege[] jcrPriv = csw.privilegesFromNames(privArray);
 
         JackrabbitAccessControlList acl = getAccessControlList(acMgr, jcrPath, 
true);
         checkState(acl != null, "No JackrabbitAccessControlList available for 
path {0}", jcrPath);
 
-        LocalRestrictions localRestrictions = 
createLocalRestrictions(restrictionClauses, acl, pcsw.getSession());
+        LocalRestrictions localRestrictions = 
createLocalRestrictions(restrictionClauses, acl, csw.getSession());
 
         AccessControlEntry[] existingAces = acl.getAccessControlEntries();
 
@@ -182,9 +182,9 @@ public class AclUtil {
                 .map(o -> 
o.contains(AclVisitor.OPTION_IGNORE_MISSING_PRINCIPAL))
                 .orElse(false);
         for (String name : principals) {
-            final Principal principal = getPrincipal(pcsw, name, 
ignoreMissingPrincipal);
+            final Principal principal = getPrincipal(csw, name, 
ignoreMissingPrincipal);
             LocalAccessControlEntry newAce =
-                    new LocalAccessControlEntry(pcsw, principal, jcrPriv, 
isAllow, localRestrictions);
+                    new LocalAccessControlEntry(csw, principal, jcrPriv, 
isAllow, localRestrictions);
             if (contains(existingAces, newAce)) {
                 LOG.info(
                         "Not adding {} to path {} since an equivalent access 
control entry already exists",
@@ -206,13 +206,13 @@ public class AclUtil {
     }
 
     @NotNull
-    private static Principal getPrincipal(PrivilegeCachingSessionWrapper pcsw, 
String name, boolean ignoreMissingPrincipal)
+    private static Principal getPrincipal(CachingSessionWrapper csw, String 
name, boolean ignoreMissingPrincipal)
             throws RepositoryException {
-        Principal principal = pcsw.getPrincipal(name);
+        Principal principal = csw.getPrincipal(name);
         if (principal == null) {
             // backwards compatibility: fallback to original code treating 
principal name as authorizable ID (see
             // SLING-8604)
-            final Authorizable authorizable = 
UserUtil.getAuthorizable(pcsw.getSession(), name);
+            final Authorizable authorizable = 
UserUtil.getAuthorizable(csw.getSession(), name);
             if (!ignoreMissingPrincipal) {
                 checkState(authorizable != null, "Authorizable not found: 
{0}", name);
                 principal = authorizable.getPrincipal();
@@ -236,9 +236,9 @@ public class AclUtil {
      * @param principalName
      * @throws RepositoryException
      */
-    public static void removePolicy(@NotNull PrivilegeCachingSessionWrapper 
pcsw, @NotNull final String principalName)
+    public static void removePolicy(@NotNull CachingSessionWrapper csw, 
@NotNull final String principalName)
             throws RepositoryException {
-        Principal principal = pcsw.getPrincipal(principalName);
+        Principal principal = csw.getPrincipal(principalName);
         if (principal == null) {
             LOG.info("Principal {} does not exist.", principalName);
             // using PrincipalImpl will prevent 'removePolicy' from failing 
with AccessControlException
@@ -246,7 +246,7 @@ public class AclUtil {
             principal = new PrincipalImpl(principalName);
         }
 
-        JackrabbitAccessControlManager acMgr = pcsw.getAccessControlManager();
+        JackrabbitAccessControlManager acMgr = csw.getAccessControlManager();
         for (JackrabbitAccessControlPolicy policy : 
acMgr.getPolicies(principal)) {
             // make sure not to remove the principal-based access control list 
but instead only drop
             // resource-based access control content for the given principal
@@ -263,11 +263,11 @@ public class AclUtil {
      * @param paths
      * @throws RepositoryException
      */
-    public static void removePolicies(@NotNull PrivilegeCachingSessionWrapper 
pcsw, @NotNull List<String> paths)
+    public static void removePolicies(@NotNull CachingSessionWrapper csw, 
@NotNull List<String> paths)
             throws RepositoryException {
-        AccessControlManager acMgr = pcsw.getAccessControlManager();
-        for (String jcrPath : getJcrPaths(pcsw.session, paths)) {
-            if (!isValidPath(pcsw.getSession(), jcrPath)) {
+        AccessControlManager acMgr = csw.getAccessControlManager();
+        for (String jcrPath : getJcrPaths(csw.session, paths)) {
+            if (!isValidPath(csw.getSession(), jcrPath)) {
                 LOG.info("Cannot remove ACL; no node at {} ", jcrPath);
                 continue;
             }
@@ -282,12 +282,12 @@ public class AclUtil {
     }
 
     public static void removeEntries(
-            @NotNull PrivilegeCachingSessionWrapper pcsw, @NotNull 
List<String> principals, @NotNull List<String> paths)
+            @NotNull CachingSessionWrapper csw, @NotNull List<String> 
principals, @NotNull List<String> paths)
             throws RepositoryException {
         Set<String> principalNames = new HashSet<>(principals);
-        AccessControlManager acMgr = pcsw.getAccessControlManager();
-        for (String jcrPath : getJcrPaths(pcsw.getSession(), paths)) {
-            if (!isValidPath(pcsw.getSession(), jcrPath)) {
+        AccessControlManager acMgr = csw.getAccessControlManager();
+        for (String jcrPath : getJcrPaths(csw.getSession(), paths)) {
+            if (!isValidPath(csw.getSession(), jcrPath)) {
                 LOG.info("Cannot remove access control entries on non-existent 
path {}", jcrPath);
             } else {
                 JackrabbitAccessControlList acl = getAccessControlList(acMgr, 
jcrPath, false);
@@ -313,7 +313,7 @@ public class AclUtil {
     }
 
     public static void removeEntries(
-            @NotNull PrivilegeCachingSessionWrapper pcsw,
+            @NotNull CachingSessionWrapper csw,
             @NotNull List<String> principals,
             @NotNull List<String> paths,
             List<String> privileges,
@@ -321,18 +321,18 @@ public class AclUtil {
             List<RestrictionClause> restrictionClauses)
             throws RepositoryException {
         Set<String> principalNames = new HashSet<>(principals);
-        AccessControlManager acMgr = pcsw.getAccessControlManager();
-        for (String jcrPath : getJcrPaths(pcsw.getSession(), paths)) {
-            if (!isValidPath(pcsw.getSession(), jcrPath)) {
+        AccessControlManager acMgr = csw.getAccessControlManager();
+        for (String jcrPath : getJcrPaths(csw.getSession(), paths)) {
+            if (!isValidPath(csw.getSession(), jcrPath)) {
                 LOG.info("Cannot remove access control entries on non-existent 
path {}", jcrPath);
             } else {
                 JackrabbitAccessControlList acl = getAccessControlList(acMgr, 
jcrPath, false);
                 if (acl != null) {
                     boolean modified = false;
 
-                    LocalRestrictions restr = 
createLocalRestrictions(restrictionClauses, acl, pcsw.getSession());
+                    LocalRestrictions restr = 
createLocalRestrictions(restrictionClauses, acl, csw.getSession());
                     Privilege[] privs =
-                            pcsw.privilegesFromNames(privileges.toArray(new 
String[0]));
+                            csw.privilegesFromNames(privileges.toArray(new 
String[0]));
 
                     for (AccessControlEntry ace : 
acl.getAccessControlEntries()) {
                         Principal principal = ace.getPrincipal();
@@ -340,7 +340,7 @@ public class AclUtil {
                             continue;
                         }
                         LocalAccessControlEntry entry =
-                                new LocalAccessControlEntry(pcsw, 
ace.getPrincipal(), privs, isAllow, restr);
+                                new LocalAccessControlEntry(csw, 
ace.getPrincipal(), privs, isAllow, restr);
                         if (entry.isEqual(ace)) {
                             acl.removeAccessControlEntry(ace);
                             modified = true;
@@ -368,15 +368,15 @@ public class AclUtil {
     }
 
     public static void setPrincipalAcl(
-            PrivilegeCachingSessionWrapper pcsw, String principalName, 
Collection<AclLine> lines, boolean isStrict)
+            CachingSessionWrapper csw, String principalName, 
Collection<AclLine> lines, boolean isStrict)
             throws RepositoryException {
-        final JackrabbitAccessControlManager acMgr = 
pcsw.getAccessControlManager();
-        Principal principal = pcsw.getPrincipal(principalName);
+        final JackrabbitAccessControlManager acMgr = 
csw.getAccessControlManager();
+        Principal principal = csw.getPrincipal(principalName);
         if (principal == null) {
             // due to transient nature of the repo-init the principal lookup 
may not succeed if completed through query
             // -> save transient changes and retry principal lookup
-            pcsw.getSession().save();
-            principal = pcsw.getPrincipal(principalName);
+            csw.getSession().save();
+            principal = csw.getPrincipal(principalName);
             checkState(principal != null, PRINCIPAL_NOT_FOUND_PATTERN, 
principalName);
         }
 
@@ -393,7 +393,7 @@ public class AclUtil {
         boolean modified = false;
         for (AclLine line : lines) {
             AclLine.Action action = line.getAction();
-            List<String> jcrPaths = getJcrPaths(pcsw.getSession(), 
line.getProperty(PROP_PATHS));
+            List<String> jcrPaths = getJcrPaths(csw.getSession(), 
line.getProperty(PROP_PATHS));
             if (action == AclLine.Action.DENY) {
                 throw new AccessControlException("PrincipalAccessControlList 
doesn't support 'deny' entries.");
             } else if (action == AclLine.Action.REMOVE) {
@@ -404,7 +404,7 @@ public class AclUtil {
                     modified = true;
                 }
             } else if (action == AclLine.Action.ALLOW) {
-                final Privilege[] privileges = pcsw.privilegesFromNames(
+                final Privilege[] privileges = csw.privilegesFromNames(
                         line.getProperty(PROP_PRIVILEGES).toArray(new 
String[0]));
                 for (String effectivePath : jcrPaths) {
                     if (acl == null) {
@@ -413,7 +413,7 @@ public class AclUtil {
                         // or if there exists no node at the effective path 
(unable to evaluate path-based entries).
                         LOG.info("No PrincipalAccessControlList available for 
principal {}", principal);
                         if (!containsEquivalentEntry(
-                                pcsw, effectivePath, principal, privileges, 
true, line.getRestrictions())) {
+                                csw, effectivePath, principal, privileges, 
true, line.getRestrictions())) {
                             LOG.warn(
                                     "No equivalent path-based entry exists for 
principal {} and effective path {} ",
                                     principal.getName(),
@@ -422,7 +422,7 @@ public class AclUtil {
                         }
                     } else {
                         final LocalRestrictions restrictions =
-                                
createLocalRestrictions(line.getRestrictions(), acl, pcsw.getSession());
+                                
createLocalRestrictions(line.getRestrictions(), acl, csw.getSession());
                         final boolean added = acl.addEntry(
                                 effectivePath,
                                 privileges,
@@ -447,30 +447,30 @@ public class AclUtil {
         }
     }
 
-    public static void removePrincipalEntries(@NotNull 
PrivilegeCachingSessionWrapper pcsw, String principalName, Collection<AclLine> 
lines)
+    public static void removePrincipalEntries(@NotNull CachingSessionWrapper 
csw, String principalName, Collection<AclLine> lines)
             throws RepositoryException {
-        final JackrabbitAccessControlManager acMgr = 
pcsw.getAccessControlManager();
-        Principal principal = pcsw.getPrincipal(principalName);
+        final JackrabbitAccessControlManager acMgr = 
csw.getAccessControlManager();
+        Principal principal = csw.getPrincipal(principalName);
         if (principal == null) {
             // due to transient nature of the repo-init the principal lookup 
may not succeed if completed through query
             // -> save transient changes and retry principal lookup
-            pcsw.getSession().save();
-            principal = pcsw.getPrincipal(principalName);
+            csw.getSession().save();
+            principal = csw.getPrincipal(principalName);
             checkState(principal != null, PRINCIPAL_NOT_FOUND_PATTERN, 
principalName);
         }
 
         final PrincipalAccessControlList acl = 
getPrincipalAccessControlList(acMgr, principal, true);
         boolean modified = false;
         for (AclLine line : lines) {
-            List<String> jcrPaths = getJcrPaths(pcsw.getSession(), 
line.getProperty(PROP_PATHS));
-            LocalRestrictions restr = 
createLocalRestrictions(line.getRestrictions(), acl, pcsw.getSession());
+            List<String> jcrPaths = getJcrPaths(csw.getSession(), 
line.getProperty(PROP_PATHS));
+            LocalRestrictions restr = 
createLocalRestrictions(line.getRestrictions(), acl, csw.getSession());
             List<String> privNames = line.getProperty(PROP_PRIVILEGES);
-            Privilege[] privs = pcsw.privilegesFromNames(privNames.toArray(new 
String[0]));
+            Privilege[] privs = csw.privilegesFromNames(privNames.toArray(new 
String[0]));
             Predicate<PrincipalAccessControlList.Entry> predicate = entry -> {
                 if (!jcrPaths.contains(entry.getEffectivePath())) {
                     return false;
                 }
-                LocalAccessControlEntry lace = new 
LocalAccessControlEntry(pcsw,
+                LocalAccessControlEntry lace = new LocalAccessControlEntry(csw,
                         entry.getPrincipal(), privs, line.getAction() == 
AclLine.Action.ALLOW, restr);
                 return lace.isEqual(entry);
             };
@@ -498,15 +498,15 @@ public class AclUtil {
      * @param principalName
      * @throws RepositoryException
      */
-    public static void removePrincipalPolicy(@NotNull 
PrivilegeCachingSessionWrapper pcsw, @NotNull String principalName)
+    public static void removePrincipalPolicy(@NotNull CachingSessionWrapper 
csw, @NotNull String principalName)
             throws RepositoryException {
-        Principal principal = pcsw.getPrincipal(principalName);
+        Principal principal = csw.getPrincipal(principalName);
         if (principal == null) {
             LOG.info("Cannot remove principal-based ACL. Principal {} does not 
exist.", principalName);
             return;
         }
 
-        JackrabbitAccessControlManager acMgr = pcsw.getAccessControlManager();
+        JackrabbitAccessControlManager acMgr = csw.getAccessControlManager();
         PrincipalAccessControlList acl = getPrincipalAccessControlList(acMgr, 
principal, false);
         if (acl == null) {
             LOG.info("Cannot remove principal-based ACL for principal {}. No 
such policy exists.", principalName);
@@ -622,25 +622,25 @@ public class AclUtil {
     }
 
     private static boolean containsEquivalentEntry(
-            PrivilegeCachingSessionWrapper pcsw,
+            CachingSessionWrapper csw,
             String absPath,
             Principal principal,
             Privilege[] privileges,
             boolean isAllow,
             List<RestrictionClause> restrictionList)
             throws RepositoryException {
-        if (absPath != null && !pcsw.getSession().nodeExists(absPath)) {
+        if (absPath != null && !csw.getSession().nodeExists(absPath)) {
             LOG.info(
                     "Cannot determine existence of equivalent path-based entry 
for principal {}. No node at path {} ",
                     principal.getName(),
                     absPath);
             return true;
         }
-        for (AccessControlPolicy policy : 
pcsw.getAccessControlManager().getPolicies(absPath)) {
+        for (AccessControlPolicy policy : 
csw.getAccessControlManager().getPolicies(absPath)) {
             if (policy instanceof JackrabbitAccessControlList) {
                 LocalRestrictions lr =
-                        createLocalRestrictions(restrictionList, 
((JackrabbitAccessControlList) policy), pcsw.getSession());
-                LocalAccessControlEntry newEntry = new 
LocalAccessControlEntry(pcsw,principal, privileges, isAllow, lr);
+                        createLocalRestrictions(restrictionList, 
((JackrabbitAccessControlList) policy), csw.getSession());
+                LocalAccessControlEntry newEntry = new 
LocalAccessControlEntry(csw,principal, privileges, isAllow, lr);
                 if (contains(((JackrabbitAccessControlList) 
policy).getAccessControlEntries(), newEntry)) {
                     LOG.info(
                             "Equivalent path-based entry exists for principal 
{} and effective path {} ",
@@ -711,19 +711,19 @@ public class AclUtil {
         private final Privilege[] privileges;
         private final boolean isAllow;
         private final LocalRestrictions restrictions;
-        private final PrivilegeCachingSessionWrapper pcsw;
+        private final CachingSessionWrapper csw;
 
-        LocalAccessControlEntry(PrivilegeCachingSessionWrapper pcsw, Principal 
principal, Privilege[] privileges, boolean isAllow) {
-            this(pcsw,principal, privileges, isAllow, null);
+        LocalAccessControlEntry(CachingSessionWrapper csw, Principal 
principal, Privilege[] privileges, boolean isAllow) {
+            this(csw,principal, privileges, isAllow, null);
         }
 
         LocalAccessControlEntry(
-                PrivilegeCachingSessionWrapper pcsw,
+                CachingSessionWrapper csw,
                 Principal principal,
                 Privilege[] privileges,
                 boolean isAllow,
                 LocalRestrictions restrictions) {
-            this.pcsw = pcsw;
+            this.csw = csw;
             this.principal = principal;
             this.privileges = privileges;
             this.isAllow = isAllow;
@@ -757,7 +757,7 @@ public class AclUtil {
 
             if (privileges != null) {
                 for (Privilege privilege : privileges) {
-                    expandedSet.addAll(pcsw.expandPrivilege(privilege));
+                    expandedSet.addAll(csw.expandPrivilege(privilege));
                 }
             }
 
diff --git a/src/main/java/org/apache/sling/jcr/repoinit/impl/AclVisitor.java 
b/src/main/java/org/apache/sling/jcr/repoinit/impl/AclVisitor.java
index 492961f..4dfe460 100644
--- a/src/main/java/org/apache/sling/jcr/repoinit/impl/AclVisitor.java
+++ b/src/main/java/org/apache/sling/jcr/repoinit/impl/AclVisitor.java
@@ -55,7 +55,7 @@ class AclVisitor extends DoNothingVisitor {
      */
     public static final String OPTION_IGNORE_MISSING_PRINCIPAL = 
"ignoreMissingPrincipal";
 
-    private final PrivilegeCachingSessionWrapper pcsw;
+    private final CachingSessionWrapper csw;
 
     private enum Instruction {
         SET,
@@ -70,7 +70,7 @@ class AclVisitor extends DoNothingVisitor {
      */
     public AclVisitor(Session s)  {
         super(s);
-        pcsw = new PrivilegeCachingSessionWrapper(s);
+        csw = new CachingSessionWrapper(s);
     }
 
     private void handleAclLine(
@@ -80,17 +80,17 @@ class AclVisitor extends DoNothingVisitor {
         if (action == AclLine.Action.REMOVE) {
             report("remove not supported. use 'remove acl' instead.");
         } else if (action == AclLine.Action.REMOVE_ALL) {
-            AclUtil.removeEntries(pcsw, principals, paths);
+            AclUtil.removeEntries(csw, principals, paths);
         } else {
             final boolean isAllow = action == AclLine.Action.ALLOW;
             final String actionName = isAllow ? "allow" : "deny";
             final List<String> privileges = line.getProperty(PROP_PRIVILEGES);
             if (instruction == Instruction.SET) {
                 log.info("Adding ACL '{}' entry '{}' for {} on {}", 
actionName, privileges, principals, paths);
-                AclUtil.setAcl(pcsw, principals, paths, privileges, isAllow, 
line.getRestrictions(), options);
+                AclUtil.setAcl(csw, principals, paths, privileges, isAllow, 
line.getRestrictions(), options);
             } else if (instruction == Instruction.REMOVE) {
                 log.info("Removing ACL '{}' entry '{}' for {} on {}", 
actionName, privileges, principals, paths);
-                AclUtil.removeEntries(pcsw, principals, paths, privileges, 
isAllow, line.getRestrictions());
+                AclUtil.removeEntries(csw, principals, paths, privileges, 
isAllow, line.getRestrictions());
             }
         }
     }
@@ -133,7 +133,7 @@ class AclVisitor extends DoNothingVisitor {
         for (String principalName : s.getPrincipals()) {
             try {
                 log.info("Adding principal-based access control entry for {}", 
principalName);
-                AclUtil.setPrincipalAcl(pcsw, principalName, s.getLines(), 
false);
+                AclUtil.setPrincipalAcl(csw, principalName, s.getLines(), 
false);
             } catch (Exception e) {
                 report(e, "Failed to set principal-based ACL (" + 
e.getMessage() + ")");
             }
@@ -145,7 +145,7 @@ class AclVisitor extends DoNothingVisitor {
         for (String principalName : s.getPrincipals()) {
             try {
                 log.info("Enforcing principal-based access control entry for 
{}", principalName);
-                AclUtil.setPrincipalAcl(pcsw, principalName, s.getLines(), 
true);
+                AclUtil.setPrincipalAcl(csw, principalName, s.getLines(), 
true);
             } catch (Exception e) {
                 report(e, "Failed to set principal-based ACL (" + 
e.getMessage() + ")");
             }
@@ -181,7 +181,7 @@ class AclVisitor extends DoNothingVisitor {
         for (String principalName : s.getPrincipals()) {
             try {
                 log.info("Removing principal-based access control entries for 
{}", principalName);
-                AclUtil.removePrincipalEntries(pcsw, principalName, 
s.getLines());
+                AclUtil.removePrincipalEntries(csw, principalName, 
s.getLines());
             } catch (Exception e) {
                 report(e, "Failed to remove principal-based access control 
entries (" + e.getMessage() + ")");
             }
@@ -193,7 +193,7 @@ class AclVisitor extends DoNothingVisitor {
         for (String principalName : s.getPrincipals()) {
             try {
                 log.info("Removing access control policy for {}", 
principalName);
-                AclUtil.removePolicy(pcsw, principalName);
+                AclUtil.removePolicy(csw, principalName);
             } catch (RepositoryException e) {
                 report(e, "Failed to remove ACL (" + e.getMessage() + ")");
             }
@@ -203,7 +203,7 @@ class AclVisitor extends DoNothingVisitor {
     @Override
     public void visitDeleteAclPaths(DeleteAclPaths s) {
         try {
-            AclUtil.removePolicies(pcsw, s.getPaths());
+            AclUtil.removePolicies(csw, s.getPaths());
         } catch (RepositoryException e) {
             report(e, "Failed to remove ACL (" + e.getMessage() + ")");
         }
@@ -214,7 +214,7 @@ class AclVisitor extends DoNothingVisitor {
         for (String principalName : s.getPrincipals()) {
             try {
                 log.info("Removing principal-based access control policy for 
{}", principalName);
-                AclUtil.removePrincipalPolicy(pcsw, principalName);
+                AclUtil.removePrincipalPolicy(csw, principalName);
             } catch (RepositoryException e) {
                 report(e, "Failed to remove principal-based ACL (" + 
e.getMessage() + ")");
             }
diff --git 
a/src/main/java/org/apache/sling/jcr/repoinit/impl/PrivilegeCachingSessionWrapper.java
 b/src/main/java/org/apache/sling/jcr/repoinit/impl/CachingSessionWrapper.java
similarity index 97%
rename from 
src/main/java/org/apache/sling/jcr/repoinit/impl/PrivilegeCachingSessionWrapper.java
rename to 
src/main/java/org/apache/sling/jcr/repoinit/impl/CachingSessionWrapper.java
index a903546..167c54f 100644
--- 
a/src/main/java/org/apache/sling/jcr/repoinit/impl/PrivilegeCachingSessionWrapper.java
+++ 
b/src/main/java/org/apache/sling/jcr/repoinit/impl/CachingSessionWrapper.java
@@ -39,7 +39,7 @@ import com.google.common.collect.Lists;
 /**
  * A simple wrapper around a session, which can cache the privilege resolution
  */
-public class PrivilegeCachingSessionWrapper {
+public class CachingSessionWrapper {
 
     JackrabbitSession session;
     JackrabbitAccessControlManager acMgr;
@@ -47,7 +47,7 @@ public class PrivilegeCachingSessionWrapper {
     Map<Privilege,List<Privilege>> privilegeToAggreate = new HashMap<>();
     Map<String,Principal> idToPrincipal = new HashMap<>();
     
-    public PrivilegeCachingSessionWrapper (Session session) {
+    public CachingSessionWrapper (Session session) {
         AclUtil.checkState(session instanceof JackrabbitSession,"A Jackrabbit 
Session is required");
         this.session = (JackrabbitSession) session;
         try {
diff --git 
a/src/test/java/org/apache/sling/jcr/repoinit/PrincipalBasedAclTest.java 
b/src/test/java/org/apache/sling/jcr/repoinit/PrincipalBasedAclTest.java
index cf1d5af..c45c5b1 100644
--- a/src/test/java/org/apache/sling/jcr/repoinit/PrincipalBasedAclTest.java
+++ b/src/test/java/org/apache/sling/jcr/repoinit/PrincipalBasedAclTest.java
@@ -57,7 +57,7 @@ import 
org.apache.jackrabbit.oak.spi.security.principal.SystemUserPrincipal;
 import org.apache.jackrabbit.oak.spi.security.user.UserConfiguration;
 import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
 import org.apache.sling.jcr.repoinit.impl.AclUtil;
-import org.apache.sling.jcr.repoinit.impl.PrivilegeCachingSessionWrapper;
+import org.apache.sling.jcr.repoinit.impl.CachingSessionWrapper;
 import org.apache.sling.jcr.repoinit.impl.RepoInitException;
 import org.apache.sling.jcr.repoinit.impl.TestUtil;
 import org.apache.sling.repoinit.parser.RepoInitParsingException;
@@ -805,7 +805,7 @@ public class PrincipalBasedAclTest {
         line.setProperty(AclLine.PROP_PRINCIPALS, 
Collections.singletonList(principal.getName()));
         line.setProperty(AclLine.PROP_PRIVILEGES, 
Collections.singletonList(Privilege.JCR_READ));
         line.setProperty(AclLine.PROP_PATHS, 
Collections.singletonList(":home:" + U.username + "#"));
-        AclUtil.setPrincipalAcl(new 
PrivilegeCachingSessionWrapper(U.adminSession), U.username, 
Collections.singletonList(line), false);
+        AclUtil.setPrincipalAcl(new CachingSessionWrapper(U.adminSession), 
U.username, Collections.singletonList(line), false);
 
         PrincipalAccessControlList acl = getAcl(principal, U.adminSession);
         assertNotNull(acl);
diff --git a/src/test/java/org/apache/sling/jcr/repoinit/impl/AclUtilTest.java 
b/src/test/java/org/apache/sling/jcr/repoinit/impl/AclUtilTest.java
index 8dc7700..56f34b5 100644
--- a/src/test/java/org/apache/sling/jcr/repoinit/impl/AclUtilTest.java
+++ b/src/test/java/org/apache/sling/jcr/repoinit/impl/AclUtilTest.java
@@ -627,7 +627,7 @@ public class AclUtilTest {
         return AccessControlUtils.privilegesFromNames(U.adminSession, 
privilegeNames);
     }
 
-    private static PrivilegeCachingSessionWrapper toPCSessionWrapper (Session 
session) {
-        return new PrivilegeCachingSessionWrapper(session);
+    private static CachingSessionWrapper toPCSessionWrapper (Session session) {
+        return new CachingSessionWrapper(session);
     }
 }
diff --git 
a/src/test/java/org/apache/sling/jcr/repoinit/impl/ManyServiceUsersTest.java 
b/src/test/java/org/apache/sling/jcr/repoinit/impl/ManyServiceUsersTest.java
index 1a93836..34a57f3 100644
--- a/src/test/java/org/apache/sling/jcr/repoinit/impl/ManyServiceUsersTest.java
+++ b/src/test/java/org/apache/sling/jcr/repoinit/impl/ManyServiceUsersTest.java
@@ -85,7 +85,7 @@ public class ManyServiceUsersTest {
 
                 try {
                     AclUtil.setAcl(
-                            new PrivilegeCachingSessionWrapper(otherSession),
+                            new CachingSessionWrapper(otherSession),
                             Arrays.asList(username),
                             Arrays.asList(path),
                             Arrays.asList("jcr:read"),

Reply via email to