jsedding commented on code in PR #45:
URL: 
https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#discussion_r1389007296


##########
src/main/java/org/apache/sling/jcr/repoinit/impl/AclUtil.java:
##########
@@ -174,9 +173,26 @@ private static void setAcl(Session session, List<String> 
principals, String jcrP
         }
     }
 
-    public static void setRepositoryAcl(Session session, List<String> 
principals, List<String> privileges, boolean isAllow, List<RestrictionClause> 
restrictionClauses)
-           throws RepositoryException {
-        setAcl(session, principals, (String)null, privileges, isAllow, 
restrictionClauses);
+    @NotNull
+    private static Principal getPrincipal(Session session, String name, 
boolean ignoreMissingPrincipal) throws RepositoryException {
+        Principal principal = AccessControlUtils.getPrincipal(session, name);
+        if (principal == null) {
+            // backwards compatibility: fallback to original code treating 
principal name as authorizable ID (see SLING-8604)
+            final Authorizable authorizable = 
UserUtil.getAuthorizable(session, name);
+            if (!ignoreMissingPrincipal) {

Review Comment:
   I prefer it the way it is. Granted, the condition _is_ probably harder to 
read and understand with what is effectively a double negation. For me, having 
what I consider to be the default code-path first, makes reading the code 
easier again. But I can totally see that there's a good argument to be made for 
both ways.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to