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 2017/11/07 09:49:12 UTC

[sling-org-apache-sling-jcr-resourcesecurity] 04/16: Don't apply gate if the resource is a jcr resource

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

rombert pushed a commit to annotated tag org.apache.sling.jcr.resourcesecurity-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-resourcesecurity.git

commit 3dc57864d3dc9049db3c7c34a47a86dc69d7a03e
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Jan 29 11:05:47 2014 +0000

    Don't apply gate if the resource is a jcr resource
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/jcr/resourcesecurity@1562400 13f79535-47bb-0310-9956-ffa450edef68
---
 .../jcr/resourcesecurity/impl/ResourceAccessGateFactory.java     | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/main/java/org/apache/sling/jcr/resourcesecurity/impl/ResourceAccessGateFactory.java b/src/main/java/org/apache/sling/jcr/resourcesecurity/impl/ResourceAccessGateFactory.java
index d102234..eab7816 100644
--- a/src/main/java/org/apache/sling/jcr/resourcesecurity/impl/ResourceAccessGateFactory.java
+++ b/src/main/java/org/apache/sling/jcr/resourcesecurity/impl/ResourceAccessGateFactory.java
@@ -20,6 +20,7 @@ package org.apache.sling.jcr.resourcesecurity.impl;
 
 import java.util.Map;
 
+import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 
@@ -69,8 +70,16 @@ public class ResourceAccessGateFactory
         return true;
     }
 
+    private boolean skipCheck(final Resource resource) {
+        // if resource is backed by a jcr node, skip check
+        return resource.adaptTo(Node.class) != null;
+    }
+
     @Override
     public GateResult canRead(final Resource resource) {
+        if ( this.skipCheck(resource) ) {
+            return GateResult.GRANTED;
+        }
         final Session session = resource.getResourceResolver().adaptTo(Session.class);
         boolean canRead = false;
         if ( session != null ) {

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.