You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "jsedding (via GitHub)" <gi...@apache.org> on 2023/10/20 13:05:10 UTC

[PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

jsedding opened a new pull request, #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45

   (no comment)


-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "jsedding (via GitHub)" <gi...@apache.org>.
jsedding commented on PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#issuecomment-1805221195

   @anchela in order to clear your "changes request" status from the PR, I clicked the "re-request review" icon. Should have done that yesterday, before you reviewed again.


-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "jsedding (via GitHub)" <gi...@apache.org>.
jsedding commented on PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#issuecomment-1778664454

   I like @kwin's suggestion to use options. Especially if that does not require a parser change. Would that work for you @anchela?
   
   @anchela yes, I am aware of the (or at least some) complications of updating the repoinit parser. I'll exercise caution.


-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "jsedding (via GitHub)" <gi...@apache.org>.
jsedding commented on code in PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#discussion_r1387262981


##########
src/main/java/org/apache/sling/jcr/repoinit/impl/DoNothingVisitor.java:
##########
@@ -66,7 +66,7 @@ protected DoNothingVisitor(Session s) {
         session = s;
     }
 
-    protected void report(Exception e, String message) {
+    protected static void report(Exception e, String message) {

Review Comment:
   It is used within the `AclVisitor.Instruction` enum, where it isn't accessible as an instance method of `AclVisitor`.



-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "jsedding (via GitHub)" <gi...@apache.org>.
jsedding commented on code in PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#discussion_r1387260196


##########
src/main/java/org/apache/sling/jcr/repoinit/impl/AclUtil.java:
##########
@@ -420,7 +419,7 @@ private static boolean isValidPath(@NotNull Session session, @Nullable String jc
     /**
      * 
      * @param acMgr the access control manager
-     * @param principal the principal
+     * @param path the path

Review Comment:
   Nope, just javadoc cleanup. I'll revert it.



-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "anchela (via GitHub)" <gi...@apache.org>.
anchela commented on code in PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#discussion_r1387009917


##########
src/main/java/org/apache/sling/jcr/repoinit/impl/AclUtil.java:
##########
@@ -152,7 +154,9 @@ private static void setAcl(Session session, List<String> principals, String jcrP
 
         boolean changed = false;
         for (String name : principals) {
-            Principal principal = AccessControlUtils.getPrincipal(session, name);
+            Principal principal = options.contains("ignoreMissingPrincipal")

Review Comment:
   i would recommend to create a constant in the jcr-repoinit space such that it is not just hidden somewhere in the code
   
   also, i would love this option to be documented in the repo-init documentation. but since that is in a separate git repo, you probably have to do it separately. but please don't forget it.



##########
src/main/java/org/apache/sling/jcr/repoinit/impl/AclVisitor.java:
##########


Review Comment:
   sorry too many changes to review with reasonable effort :(
   can you avoid any renaming of methods that are unrelated to the change required here?
   i am all in favor of cleaning up the code base, but please use a separate ticket for that.



##########
src/main/java/org/apache/sling/jcr/repoinit/impl/AclUtil.java:
##########
@@ -152,7 +154,9 @@ private static void setAcl(Session session, List<String> principals, String jcrP
 
         boolean changed = false;
         for (String name : principals) {
-            Principal principal = AccessControlUtils.getPrincipal(session, name);
+            Principal principal = options.contains("ignoreMissingPrincipal")
+                    ? () -> name

Review Comment:
   i would slightly alter the logic here, as the fallback below is significant..... if you just use the specified name now, you might break that contract below.
   
   so, i would suggest:
   - always try to retrieve the principal first
   - if it does not exist -> try backwards compatible fallback to original code
   - if it does not exist -> create the anonymous principal in case option is set as you do here, otherwise use old behavior.
   
   i believe this way we run the least risk of introducing subtle regressions that are super hard to troubleshoot.



##########
src/main/java/org/apache/sling/jcr/repoinit/impl/DoNothingVisitor.java:
##########
@@ -66,7 +66,7 @@ protected DoNothingVisitor(Session s) {
         session = s;
     }
 
-    protected void report(Exception e, String message) {
+    protected static void report(Exception e, String message) {

Review Comment:
   unrelated to the task at hand. please move that to a general cleanup.improvmeent PR.



##########
src/test/java/org/apache/sling/jcr/repoinit/GeneralAclTest.java:
##########
@@ -270,9 +270,9 @@ private void verifyRegisterNamespace(String username, String prefix, String uri,
         try {
             userSession = U.loginService(username);
             userSession.getWorkspace().getNamespaceRegistry().registerNamespace(prefix, uri);
-            assertTrue("Register namespace succeeded " + prefix + uri, successExpected);
+            assertTrue("Register namespace succeeded " + prefix + " " + uri, successExpected);
         } catch (RepositoryException e) {
-            assertTrue("Error registering namespace " + prefix + uri + " " + e.getMessage(), !successExpected);
+            assertFalse("Error registering namespace " + prefix + " " + uri + " " + e.getMessage(), successExpected);

Review Comment:
   ???? what does the changes for SLING-12115 lead to a changed assertion in a namespace related test? that doesn't look good at all.



##########
src/main/java/org/apache/sling/jcr/repoinit/impl/AclUtil.java:
##########
@@ -420,7 +419,7 @@ private static boolean isValidPath(@NotNull Session session, @Nullable String jc
     /**
      * 
      * @param acMgr the access control manager
-     * @param principal the principal
+     * @param path the path

Review Comment:
   is that change related?



-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "jsedding (via GitHub)" <gi...@apache.org>.
jsedding commented on code in PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#discussion_r1388150998


##########
src/test/java/org/apache/sling/jcr/repoinit/GeneralAclTest.java:
##########
@@ -270,9 +270,9 @@ private void verifyRegisterNamespace(String username, String prefix, String uri,
         try {
             userSession = U.loginService(username);
             userSession.getWorkspace().getNamespaceRegistry().registerNamespace(prefix, uri);
-            assertTrue("Register namespace succeeded " + prefix + uri, successExpected);
+            assertTrue("Register namespace succeeded " + prefix + " " + uri, successExpected);
         } catch (RepositoryException e) {
-            assertTrue("Error registering namespace " + prefix + uri + " " + e.getMessage(), !successExpected);
+            assertFalse("Error registering namespace " + prefix + " " + uri + " " + e.getMessage(), successExpected);

Review Comment:
   Yes, I fully agree. The diff should focus on the issue at hand. FYI, I reverted this change.



-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "rombert (via GitHub)" <gi...@apache.org>.
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "jsedding (via GitHub)" <gi...@apache.org>.
jsedding commented on code in PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#discussion_r1387260516


##########
src/main/java/org/apache/sling/jcr/repoinit/impl/AclUtil.java:
##########
@@ -152,7 +154,9 @@ private static void setAcl(Session session, List<String> principals, String jcrP
 
         boolean changed = false;
         for (String name : principals) {
-            Principal principal = AccessControlUtils.getPrincipal(session, name);
+            Principal principal = options.contains("ignoreMissingPrincipal")
+                    ? () -> name

Review Comment:
   Sounds sensible. Thanks for catching this change in logic!



-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#issuecomment-1803106704

   SonarCloud Quality Gate failed.&nbsp; &nbsp; [![Quality Gate failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/failed-16px.png 'Quality Gate failed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=CODE_SMELL) [1 Code Smell](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=CODE_SMELL)
   
   [![79.2%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '79.2%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_coverage&view=list) [79.2% Coverage](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_duplicated_lines_density&view=list)
   
   
   
   ![idea](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/light_bulb-16px.png 'idea') Catch issues before they fail your Quality Gate with our IDE extension ![sonarlint](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/sonarlint-16px.png 'sonarlint') [SonarLint](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=sonarcloud-welcome)


-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "anchela (via GitHub)" <gi...@apache.org>.
anchela commented on code in PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#discussion_r1388015841


##########
src/main/java/org/apache/sling/jcr/repoinit/impl/AclVisitor.java:
##########


Review Comment:
   @jsedding , those are all valid points... it's just that i don't have the bandwidths to review it. too many reviews piling up. i don't insist that you revert it and i see the benefit of improving the repoinit code.... but i would love someone else to take a look and verify that the result is equivalent. maybe @kwin , @cziegeler  or @rombert can jump in here?



-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#issuecomment-1772721509

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=CODE_SMELL)
   
   [![100.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/100-16px.png '100.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_coverage&view=list) [100.0% Coverage](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_duplicated_lines_density&view=list)
   
   


-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#issuecomment-1790360408

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=CODE_SMELL) [2 Code Smells](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=CODE_SMELL)
   
   [![81.5%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '81.5%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_coverage&view=list) [81.5% Coverage](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_duplicated_lines_density&view=list)
   
   


-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "jsedding (via GitHub)" <gi...@apache.org>.
jsedding commented on code in PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#discussion_r1387259771


##########
src/main/java/org/apache/sling/jcr/repoinit/impl/AclVisitor.java:
##########


Review Comment:
   I did this refactoring so that `SetAclPrincipals` and `SetAclPaths` share the same code-path and to remove code-duplication. For symmetry, and because just removing the "set ACL" part from the method `setAcl` seemed strange, I did the same for `RemoveAcePrincipals` and `RemoveAcePaths`. The final reason, why I didn't want a `setAcl` method in this class is, that it clashes with `AclUtil#setAcl`, which I found confusing.
   
   The method `setRepositoryAcl` was a copy & paste of `setAcl`, omitting only the `paths` argument, which was set to `null` in the removed `AclUtil#setRepositoryAcl`. Removing this in favour of explicitly injecting the `:repository` path, seemed much clearer to me.
   
   Finally, the `require` method was actually a no-op, because `AclLine#getProperty()` [never returns `null`](https://github.com/apache/sling-org-apache-sling-repoinit-parser/blob/ea340191058fefe84ba9134f8025f71a69295a14/src/main/java/org/apache/sling/repoinit/parser/operations/AclLine.java#L64-L67).
   
   If you insist, I can try to revert these changes in favour of a minimal change-set approach.



-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "jsedding (via GitHub)" <gi...@apache.org>.
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "anchela (via GitHub)" <gi...@apache.org>.
anchela commented on code in PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#discussion_r1388010901


##########
src/main/java/org/apache/sling/jcr/repoinit/impl/AclUtil.java:
##########
@@ -420,7 +419,7 @@ private static boolean isValidPath(@NotNull Session session, @Nullable String jc
     /**
      * 
      * @param acMgr the access control manager
-     * @param principal the principal
+     * @param path the path

Review Comment:
   don;t get me wrong..... i am all for cleaning up code and actively maintaining it... but i would love this to happen with a separate PR. such that we can really track what has changed and why.



-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "anchela (via GitHub)" <gi...@apache.org>.
anchela commented on code in PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#discussion_r1388009498


##########
src/main/java/org/apache/sling/jcr/repoinit/impl/AclUtil.java:
##########
@@ -152,7 +154,9 @@ private static void setAcl(Session session, List<String> principals, String jcrP
 
         boolean changed = false;
         for (String name : principals) {
-            Principal principal = AccessControlUtils.getPrincipal(session, name);
+            Principal principal = options.contains("ignoreMissingPrincipal")

Review Comment:
   lgtm now



-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "anchela (via GitHub)" <gi...@apache.org>.
anchela commented on PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#issuecomment-1777622875

   @jsedding , i am not entirely sure that this modification justifies adding new repo-init language. but if we take that route, please make also sure to adjust other bundles like the cp-converter. it's doable but if forgotten will result in breaking AEMaaCS.


-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "jsedding (via GitHub)" <gi...@apache.org>.
jsedding commented on code in PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#discussion_r1387262475


##########
src/main/java/org/apache/sling/jcr/repoinit/impl/AclUtil.java:
##########
@@ -152,7 +154,9 @@ private static void setAcl(Session session, List<String> principals, String jcrP
 
         boolean changed = false;
         for (String name : principals) {
-            Principal principal = AccessControlUtils.getPrincipal(session, name);
+            Principal principal = options.contains("ignoreMissingPrincipal")

Review Comment:
   +1 to both points.
   
   Regarding documentation, it's probably best to add a test-case example in the repoinit parser module. AFAIK the test files are included in the documentation. I suppose that's the downside of having `ACLOptions` accept all strings.



-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#issuecomment-1803076700

   SonarCloud Quality Gate failed.&nbsp; &nbsp; [![Quality Gate failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/failed-16px.png 'Quality Gate failed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=CODE_SMELL) [2 Code Smells](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=CODE_SMELL)
   
   [![79.2%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '79.2%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_coverage&view=list) [79.2% Coverage](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_duplicated_lines_density&view=list)
   
   
   
   ![idea](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/light_bulb-16px.png 'idea') Catch issues before they fail your Quality Gate with our IDE extension ![sonarlint](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/sonarlint-16px.png 'sonarlint') [SonarLint](https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=sonarcloud-welcome)


-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "jsedding (via GitHub)" <gi...@apache.org>.
jsedding commented on PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#issuecomment-1803003694

   @anchela thank you for the review! I have tried to address the issues you pointed out, and I have tried to simplify the diff of the AclVisitor class, without reverting back to the previous version. I'll let you be the judge of whether I succeeded in simplifying the diff 😅 


-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "anchela (via GitHub)" <gi...@apache.org>.
anchela commented on code in PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#discussion_r1388016165


##########
src/main/java/org/apache/sling/jcr/repoinit/impl/DoNothingVisitor.java:
##########
@@ -66,7 +66,7 @@ protected DoNothingVisitor(Session s) {
         session = s;
     }
 
-    protected void report(Exception e, String message) {
+    protected static void report(Exception e, String message) {

Review Comment:
   i see



-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "jsedding (via GitHub)" <gi...@apache.org>.
jsedding commented on PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#issuecomment-1794381325

   If there are no objections, I will merge this PR tomorrow.


-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "jsedding (via GitHub)" <gi...@apache.org>.
jsedding commented on code in PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#discussion_r1387263538


##########
src/test/java/org/apache/sling/jcr/repoinit/GeneralAclTest.java:
##########
@@ -270,9 +270,9 @@ private void verifyRegisterNamespace(String username, String prefix, String uri,
         try {
             userSession = U.loginService(username);
             userSession.getWorkspace().getNamespaceRegistry().registerNamespace(prefix, uri);
-            assertTrue("Register namespace succeeded " + prefix + uri, successExpected);
+            assertTrue("Register namespace succeeded " + prefix + " " + uri, successExpected);
         } catch (RepositoryException e) {
-            assertTrue("Error registering namespace " + prefix + uri + " " + e.getMessage(), !successExpected);
+            assertFalse("Error registering namespace " + prefix + " " + uri + " " + e.getMessage(), successExpected);

Review Comment:
   True, that's cleanup.



-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "jsedding (via GitHub)" <gi...@apache.org>.
jsedding commented on PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#issuecomment-1804022381

   Thank you for your reviews, @anchela! Addressing the points you raised forced me to look at all the details again, and I believe the result is an improvement over the previous state.


-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#issuecomment-1802976809

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=CODE_SMELL) [2 Code Smells](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=CODE_SMELL)
   
   [![82.4%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '82.4%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_coverage&view=list) [82.4% Coverage](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_duplicated_lines_density&view=list)
   
   


-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#issuecomment-1789248345

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=CODE_SMELL) [4 Code Smells](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=CODE_SMELL)
   
   [![80.4%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '80.4%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_coverage&view=list) [80.4% Coverage](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_duplicated_lines_density&view=list)
   
   


-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "jsedding (via GitHub)" <gi...@apache.org>.
jsedding commented on code in PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#discussion_r1387262981


##########
src/main/java/org/apache/sling/jcr/repoinit/impl/DoNothingVisitor.java:
##########
@@ -66,7 +66,7 @@ protected DoNothingVisitor(Session s) {
         session = s;
     }
 
-    protected void report(Exception e, String message) {
+    protected static void report(Exception e, String message) {

Review Comment:
   +1



-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#issuecomment-1803721129

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=CODE_SMELL)
   
   [![87.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '87.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_coverage&view=list) [87.0% Coverage](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_duplicated_lines_density&view=list)
   
   


-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "anchela (via GitHub)" <gi...@apache.org>.
anchela commented on code in PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#discussion_r1388024166


##########
src/test/java/org/apache/sling/jcr/repoinit/GeneralAclTest.java:
##########
@@ -270,9 +270,9 @@ private void verifyRegisterNamespace(String username, String prefix, String uri,
         try {
             userSession = U.loginService(username);
             userSession.getWorkspace().getNamespaceRegistry().registerNamespace(prefix, uri);
-            assertTrue("Register namespace succeeded " + prefix + uri, successExpected);
+            assertTrue("Register namespace succeeded " + prefix + " " + uri, successExpected);
         } catch (RepositoryException e) {
-            assertTrue("Error registering namespace " + prefix + uri + " " + e.getMessage(), !successExpected);
+            assertFalse("Error registering namespace " + prefix + " " + uri + " " + e.getMessage(), successExpected);

Review Comment:
   but unrelated to the task at hand, right?
   i really would like changes to a particular bug or improvement to be limited to the task at hand.... for me just looking at the diff it's just harder to figure out why something was change.



-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "jsedding (via GitHub)" <gi...@apache.org>.
jsedding commented on PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#issuecomment-1789180598

   I have implemented this using the following, option based, syntax:
   
   ```
   set ACL for nonExistingGroup (ACLOptions=ignoreMissingPrincipal)
     allow jcr:read on /
   end
   ```
   
   With this implementation, the current behaviour remains unchanged. Only when this new option is present, will the check for existence of the principal in repoinit be skipped. In that case, the behaviour of the repository determines, what happens.
   
   Does this look acceptable? And could this approach be recommended to be employed for cases where an external principal is not yet sync'ed into the repository?
   
   cc @bdelacretaz @anchela @kwin


-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "jsedding (via GitHub)" <gi...@apache.org>.
jsedding commented on PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#issuecomment-1777486919

   Thinking about this change some more, I am inclined to close this PR. If we really want to support creating ACLs for possible non-existing principals, we should add that to the repoinit language and make it explicit.


-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#issuecomment-1790261554

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=CODE_SMELL) [7 Code Smells](https://sonarcloud.io/project/issues?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&resolved=false&types=CODE_SMELL)
   
   [![80.4%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '80.4%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_coverage&view=list) [80.4% Coverage](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_sling-org-apache-sling-jcr-repoinit&pullRequest=45&metric=new_duplicated_lines_density&view=list)
   
   


-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "jsedding (via GitHub)" <gi...@apache.org>.
jsedding merged PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45


-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "anchela (via GitHub)" <gi...@apache.org>.
anchela commented on code in PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#discussion_r1388008517


##########
src/main/java/org/apache/sling/jcr/repoinit/impl/AclUtil.java:
##########
@@ -156,8 +156,11 @@ private static void setAcl(Session session, List<String> principals, String jcrP
             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);
-                checkState(authorizable != null, "Authorizable not found: {0}", name);
-                principal = authorizable.getPrincipal();
+                if (authorizable != null) {
+                    principal = authorizable.getPrincipal();
+                } else {
+                    principal = () -> name;

Review Comment:
   yes, i agree



-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "jsedding (via GitHub)" <gi...@apache.org>.
jsedding commented on code in PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#discussion_r1382983926


##########
src/main/java/org/apache/sling/jcr/repoinit/impl/AclUtil.java:
##########
@@ -156,8 +156,11 @@ private static void setAcl(Session session, List<String> principals, String jcrP
             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);
-                checkState(authorizable != null, "Authorizable not found: {0}", name);
-                principal = authorizable.getPrincipal();
+                if (authorizable != null) {
+                    principal = authorizable.getPrincipal();
+                } else {
+                    principal = () -> name;

Review Comment:
   I think this is resolved with my latest changes.



-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "anchela (via GitHub)" <gi...@apache.org>.
anchela commented on code in PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#discussion_r1366971895


##########
src/main/java/org/apache/sling/jcr/repoinit/impl/AclUtil.java:
##########
@@ -156,8 +156,11 @@ private static void setAcl(Session session, List<String> principals, String jcrP
             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);
-                checkState(authorizable != null, "Authorizable not found: {0}", name);
-                principal = authorizable.getPrincipal();
+                if (authorizable != null) {
+                    principal = authorizable.getPrincipal();
+                } else {
+                    principal = () -> name;

Review Comment:
   since the previous behavior was to throw an exception, i would recommend to at least log a warning here.



-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#issuecomment-1777657743

   I think this doesn't require a new instruction but just an extension for  principal centered ACLs with options (introduced in https://issues.apache.org/jira/browse/SLING-6423).


-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] SLING-12115 - Repoinit should leave importBehaviour for ACL creation to JCR [sling-org-apache-sling-jcr-repoinit]

Posted by "anchela (via GitHub)" <gi...@apache.org>.
anchela commented on PR #45:
URL: https://github.com/apache/sling-org-apache-sling-jcr-repoinit/pull/45#issuecomment-1779107332

   @jsedding , the options were initially introduced into the parser to add the same option-nightmare that we are having in filevault. fortunately, this was never implemented in jcr-repoinit and i hoped to make it clear in JIRA why I would oppose to that.
   if we can repurpose the options for something sensible, i don't mind.... but maybe you also want to reach out @bdelacretaz . he might want to have a say here as the original author of repoinit.


-- 
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: dev-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org