You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2019/09/17 12:45:49 UTC
[sling-org-apache-sling-jcr-repoinit] branch master updated:
SLING-8605 - AclUtil.createLocalRestrictions should use
JackrabbitAccessControlList.isMultiValueRestriction(String)
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git
The following commit(s) were added to refs/heads/master by this push:
new da2a93d SLING-8605 - AclUtil.createLocalRestrictions should use JackrabbitAccessControlList.isMultiValueRestriction(String)
da2a93d is described below
commit da2a93d00a6083e9549bf3afc60ffd39e2b65d6e
Author: Angela Schreiber <an...@apache.org>
AuthorDate: Tue Sep 17 14:45:17 2019 +0200
SLING-8605 - AclUtil.createLocalRestrictions should use JackrabbitAccessControlList.isMultiValueRestriction(String)
---
src/main/java/org/apache/sling/jcr/repoinit/impl/AclUtil.java | 9 +++++----
1 file changed, 5 insertions(+), 4 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 1adb0e7..fdf3dbf 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
@@ -73,6 +73,7 @@ public class AclUtil {
for(RestrictionClause rc : list){
String restrictionName = rc.getName();
int type = jacl.getRestrictionType(restrictionName);
+ boolean isMvRestriction = jacl.isMultiValueRestriction(restrictionName);
Value[] values = new Value[rc.getValues().size()];
for(int i=0;i<values.length;i++) {
values[i] = vf.createValue(rc.getValues().get(i),type);
@@ -82,15 +83,15 @@ public class AclUtil {
// SLING-7280 - special case for rep:glob which supports an empty string
// to mean "no values"
restrictions.put(restrictionName, vf.createValue(""));
- } else if(values.length == 1) {
- restrictions.put(restrictionName, values[0]);
- } else {
+ } else if (isMvRestriction) {
mvrestrictions.put(restrictionName, values);
+ } else {
+ checkState(values.length == 1, "Expected just one value for single valued restriction with name " + restrictionName);
+ restrictions.put(restrictionName, values[0]);
}
}
}
return new LocalRestrictions(restrictions,mvrestrictions);
-
}