jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1466944 - /jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/ShadowInvisibleContentTest.java
Date Thu, 11 Apr 2013 16:23:12 GMT
Author: mduerig
Date: Thu Apr 11 16:23:11 2013
New Revision: 1466944

URL: http://svn.apache.org/r1466944
Log:
OAK-709: Consider moving permission evaluation to the node state level
test: shadow invisible property should result on access violation on commit. Currently ignored.
See TODO in PermissionValidator.childNodeChanged().

Modified:
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/ShadowInvisibleContentTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/ShadowInvisibleContentTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/ShadowInvisibleContentTest.java?rev=1466944&r1=1466943&r2=1466944&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/ShadowInvisibleContentTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/ShadowInvisibleContentTest.java
Thu Apr 11 16:23:11 2013
@@ -20,6 +20,8 @@ package org.apache.jackrabbit.oak.securi
  
 import static org.apache.jackrabbit.JcrConstants.NT_UNSTRUCTURED;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
 import java.security.Principal;
@@ -41,6 +43,7 @@ import org.apache.jackrabbit.oak.api.Tre
 import org.apache.jackrabbit.oak.security.privilege.PrivilegeConstants;
 import org.apache.jackrabbit.oak.util.NodeUtil;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 
 public class ShadowInvisibleContentTest extends AbstractSecurityTest {
@@ -61,7 +64,7 @@ public class ShadowInvisibleContentTest 
         NodeUtil b = a.addChild("b", NT_UNSTRUCTURED);
         b.setString("y", "yValue");
         NodeUtil c = b.addChild("c", NT_UNSTRUCTURED);
-        c.setString("propName3", "strValue");
+        c.setString("z", "zValue");
     }
      
     private void setupPermission(Principal principal, String path, boolean isAllow, String
privilegeName)
@@ -87,7 +90,13 @@ public class ShadowInvisibleContentTest 
 
         Root root = getLatestRoot();
         Tree a = root.getTree("/a");
+
+        // /b not visible to this session
+        assertFalse(a.hasChild("b"));
+
+        // shadow /b with transient node of the same name
         Tree b = a.addChild("b");
+        assertTrue(a.hasChild("b"));
         assertFalse(b.hasChild("c"));
 
         try {
@@ -97,4 +106,27 @@ public class ShadowInvisibleContentTest 
         }
     }
 
+    @Test
+    @Ignore  // TODO incomplete implementation of PermissionValidator.childNodeChanged()
+    public void testShadowInvisibleProperty() throws CommitFailedException, RepositoryException,
LoginException {
+        setupPermission(userPrincipal, "/a", true, PrivilegeConstants.JCR_ALL);
+        setupPermission(userPrincipal, "/a", false, PrivilegeConstants.REP_READ_PROPERTIES);
+
+        Root root = getLatestRoot();
+        Tree a = root.getTree("/a");
+
+        // /a/x not visible to this session
+        assertNull(a.getProperty("x"));
+
+        // shadow /a/x with transient property of the same name
+        a.setProperty("x", "xValue1");
+        assertNotNull(a.getProperty("x"));
+
+        try {
+            root.commit();
+        } catch (CommitFailedException e) {
+            assertTrue(e.isAccessViolation());
+        }
+    }
+
 }



Mime
View raw message