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


##########
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:
   Nit: I would remove the double negation and write the statement as
   
   if ( ignoreMissingPrincipal ) {
   ...
   } else {
   ...
   }



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