You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by GitBox <gi...@apache.org> on 2018/10/16 16:18:34 UTC

[GitHub] ghenzler closed pull request #1: SLING-8026: remove TreeUtil to be compatible with oax 1.8.x

ghenzler closed pull request #1: SLING-8026: remove TreeUtil to be compatible with oax 1.8.x
URL: https://github.com/apache/sling-org-apache-sling-oak-restrictions/pull/1
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/pom.xml b/pom.xml
index 1614995..f3793c0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -53,7 +53,6 @@
                         -->
                         <Import-Package>
                             org.apache.jackrabbit.oak.api;version="[1.0,4)",
-                            org.apache.jackrabbit.oak.util;version="0.0.0",
                             *
                         </Import-Package>
                     </instructions>
diff --git a/src/main/java/org/apache/sling/oak/restrictions/impl/ResourceTypePattern.java b/src/main/java/org/apache/sling/oak/restrictions/impl/ResourceTypePattern.java
index e2dd109..432f554 100644
--- a/src/main/java/org/apache/sling/oak/restrictions/impl/ResourceTypePattern.java
+++ b/src/main/java/org/apache/sling/oak/restrictions/impl/ResourceTypePattern.java
@@ -24,8 +24,8 @@
 
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Tree;
+import org.apache.jackrabbit.oak.api.Type;
 import org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionPattern;
-import org.apache.jackrabbit.oak.util.TreeUtil;
 import org.apache.sling.api.SlingConstants;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -126,7 +126,7 @@ private boolean matchesAtTree(Tree tree) {
                 }
                 
                 Set<String> resourceTypesForPath = resourceTypesByPath.get(path);
-                String actualResourceType = TreeUtil.getString(treeToCheck, SLING_RESOURCE_TYPE);
+                String actualResourceType = getResourceTypeFromTree(treeToCheck);
                 isResourceTypeMatch = resourceTypesForPath.contains(actualResourceType);
                 
                 if(LOG.isTraceEnabled()) {
@@ -140,6 +140,10 @@ private boolean matchesAtTree(Tree tree) {
         return isResourceTypeMatch;
     }
 
+    public String getResourceTypeFromTree(Tree treeToCheck) {
+        PropertyState property = treeToCheck.getProperty(SLING_RESOURCE_TYPE);
+        return property != null && !property.isArray() ? property.getValue(Type.STRING) : null;
+    }
 
     @Override
     public boolean matches(@NotNull String path) {


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services