You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by si...@apache.org on 2019/06/21 09:07:17 UTC

[sling-org-apache-sling-feature-cpconverter] branch master updated: SLING-8527 - Glob restrictions for content-package formatted wrong

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

simonetripodi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-cpconverter.git


The following commit(s) were added to refs/heads/master by this push:
     new 812794e  SLING-8527 - Glob restrictions for content-package formatted wrong
812794e is described below

commit 812794edee8f406b036449b4d901f08f175903e8
Author: Simo Tripodi <st...@adobe.com>
AuthorDate: Fri Jun 21 11:07:10 2019 +0200

    SLING-8527 - Glob restrictions for content-package formatted wrong
---
 .../sling/feature/cpconverter/handlers/RepPolicyEntryHandler.java    | 5 ++++-
 .../feature/cpconverter/handlers/RepPolicyEntryHandlerTest.java      | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/feature/cpconverter/handlers/RepPolicyEntryHandler.java b/src/main/java/org/apache/sling/feature/cpconverter/handlers/RepPolicyEntryHandler.java
index 7e0109a..6b8407c 100644
--- a/src/main/java/org/apache/sling/feature/cpconverter/handlers/RepPolicyEntryHandler.java
+++ b/src/main/java/org/apache/sling/feature/cpconverter/handlers/RepPolicyEntryHandler.java
@@ -115,7 +115,10 @@ public final class RepPolicyEntryHandler extends AbstractRegexEntryHandler {
                     acls.add(aclManager.addAcl(principalName, operation, privileges, path));
                 } else if (REP_RESTRICTIONS.equals(primaryType) && !acls.isEmpty()) {
                     String restriction = attributes.getValue(REP_GLOB);
-                    acls.peek().addRestriction(restriction);
+
+                    if (restriction != null && !restriction.isEmpty()) {
+                        acls.peek().addRestriction(REP_GLOB + ',' + restriction);
+                    }
                 }
             } else {
                 super.startElement(uri, localName, qName, attributes);
diff --git a/src/test/java/org/apache/sling/feature/cpconverter/handlers/RepPolicyEntryHandlerTest.java b/src/test/java/org/apache/sling/feature/cpconverter/handlers/RepPolicyEntryHandlerTest.java
index 1d947f4..238b1a6 100644
--- a/src/test/java/org/apache/sling/feature/cpconverter/handlers/RepPolicyEntryHandlerTest.java
+++ b/src/test/java/org/apache/sling/feature/cpconverter/handlers/RepPolicyEntryHandlerTest.java
@@ -83,7 +83,7 @@ public final class RepPolicyEntryHandlerTest {
                 "create path (sling:Folder) /asd/public\n" + 
                 "create service user acs-commons-ensure-oak-index-service\n" + 
                 "set ACL for acs-commons-ensure-oak-index-service\n" + 
-                "allow jcr:read,rep:write,rep:indexDefinitionManagement on /asd/public restriction(*/oak:index/*)\n" + 
+                "allow jcr:read,rep:write,rep:indexDefinitionManagement on /asd/public restriction(rep:glob,*/oak:index/*)\n" + 
                 "end\n" + 
                 "create service user acs-commons-dispatcher-flush-service\n" + 
                 "set ACL for acs-commons-dispatcher-flush-service\n" +