You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by kw...@apache.org on 2021/10/27 13:37:13 UTC

[sling-org-apache-sling-jcr-resourcesecurity] branch master updated: SLING-7975 support reordering of resources

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

kwin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-resourcesecurity.git


The following commit(s) were added to refs/heads/master by this push:
     new 86c6639  SLING-7975 support reordering of resources
86c6639 is described below

commit 86c6639c821997a0b78f3f379ad634aec730fb84
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Wed Oct 27 15:37:09 2021 +0200

    SLING-7975 support reordering of resources
---
 pom.xml                                               |  2 +-
 .../impl/ResourceAccessGateFactory.java               | 19 ++++++++++++++++++-
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 2cc3737..61983f5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -98,7 +98,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.resourceaccesssecurity</artifactId>
-            <version>1.0.0</version>
+            <version>1.0.1-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
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 a2171f7..ecff501 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
@@ -54,7 +54,7 @@ import org.apache.sling.resourceaccesssecurity.ResourceAccessGate;
     @Property(name=ResourceAccessGateFactory.PROP_JCR_PATH,
               label="JCR Node",
               description="This node is checked for permissions to the resources."),
-    @Property(name=ResourceAccessGate.OPERATIONS, value= {"read", "create", "update", "delete"}, propertyPrivate=true),
+    @Property(name=ResourceAccessGate.OPERATIONS, value= {"read", "create", "update", "delete", "reorder-children"}, propertyPrivate=true),
     @Property(name=ResourceAccessGate.CONTEXT, value=ResourceAccessGate.PROVIDER_CONTEXT, propertyPrivate=true)
 })
 public class ResourceAccessGateFactory
@@ -117,6 +117,14 @@ public class ResourceAccessGateFactory
     }
 
     /**
+     * @see org.apache.sling.resourceaccesssecurity.AllowingResourceAccessGate#hasReorderChildrenRestrictions(org.apache.sling.api.resource.ResourceResolver)
+     */
+    @Override
+    public boolean hasReorderChildrenRestrictions(ResourceResolver resourceResolver) {
+        return true;
+    }
+
+    /**
      * @see org.apache.sling.resourceaccesssecurity.AllowingResourceAccessGate#hasUpdateRestrictions(org.apache.sling.api.resource.ResourceResolver)
      */
     @Override
@@ -132,6 +140,7 @@ public class ResourceAccessGateFactory
         return true;
     }
 
+    
     /**
      * @see org.apache.sling.resourceaccesssecurity.AllowingResourceAccessGate#canRead(org.apache.sling.api.resource.Resource)
      */
@@ -163,4 +172,12 @@ public class ResourceAccessGateFactory
     public GateResult canCreate(String absPathName, ResourceResolver resourceResolver) {
         return this.checkPermission(resourceResolver, absPathName, Session.ACTION_ADD_NODE);
     }
+
+    /**
+     * @see org.apache.sling.resourceaccesssecurity.AllowingResourceAccessGate#canReorderChildren(Resource)
+     */
+    @Override
+    public GateResult canReorderChildren(Resource resource) {
+        return this.checkPermission(resource.getResourceResolver(), resource.getPath(), Session.ACTION_SET_PROPERTY);
+    }
 }