You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by an...@apache.org on 2013/04/11 09:11:43 UTC
svn commit: r1466776 - in
/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization:
RenameTest.java WriteTest.java
Author: angela
Date: Thu Apr 11 07:11:42 2013
New Revision: 1466776
URL: http://svn.apache.org/r1466776
Log:
OAK-527: permissions (WIP: tests)
Added:
jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/RenameTest.java
Modified:
jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/WriteTest.java
Added: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/RenameTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/RenameTest.java?rev=1466776&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/RenameTest.java (added)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/RenameTest.java Thu Apr 11 07:11:42 2013
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.jcr.security.authorization;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.Node;
+import javax.jcr.security.Privilege;
+
+import org.apache.jackrabbit.api.JackrabbitNode;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * RenameTest... TODO
+ */
+@Ignore("OAK-770 : NodeImpl doesn't implement JackrabbitNode#rename")
+public class RenameTest extends AbstractEvaluationTest {
+
+ @Test
+ public void testRename() throws Exception {
+ Node child = testSession.getNode(childNPath);
+ try {
+ ((JackrabbitNode) child).rename("rename");
+ testSession.save();
+ fail("test session must not be allowed to rename nodes.");
+ } catch (AccessDeniedException e) {
+ // success.
+ }
+
+ // give 'add_child_nodes' and 'nt-management' privilege
+ // -> not sufficient privileges for a renaming of the child
+ allow(path, privilegesFromNames(new String[] {Privilege.JCR_ADD_CHILD_NODES, Privilege.JCR_NODE_TYPE_MANAGEMENT}));
+ try {
+ ((JackrabbitNode) child).rename("rename");
+ testSession.save();
+ fail("test session must not be allowed to rename nodes.");
+ } catch (AccessDeniedException e) {
+ // success.
+ }
+
+ // add 'remove_child_nodes' at 'path
+ // -> rename of child must now succeed
+ allow(path, privilegesFromName(Privilege.JCR_REMOVE_CHILD_NODES));
+ ((JackrabbitNode) child).rename("rename");
+ testSession.save();
+ }
+}
\ No newline at end of file
Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/WriteTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/WriteTest.java?rev=1466776&r1=1466775&r2=1466776&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/WriteTest.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/WriteTest.java Thu Apr 11 07:11:42 2013
@@ -25,7 +25,6 @@ import javax.jcr.Session;
import javax.jcr.security.AccessControlManager;
import javax.jcr.security.Privilege;
-import org.apache.jackrabbit.api.JackrabbitNode;
import org.apache.jackrabbit.api.security.JackrabbitAccessControlList;
import org.apache.jackrabbit.api.security.user.Group;
import org.apache.jackrabbit.commons.jackrabbit.authorization.AccessControlUtils;
@@ -380,35 +379,6 @@ public class WriteTest extends AbstractE
testSession.save();
}
- @Test
- public void testRename() throws Exception {
- Node child = testSession.getNode(childNPath);
- try {
- ((JackrabbitNode) child).rename("rename");
- testSession.save();
- fail("test session must not be allowed to rename nodes.");
- } catch (AccessDeniedException e) {
- // success.
- }
-
- // give 'add_child_nodes' and 'nt-management' privilege
- // -> not sufficient privileges for a renaming of the child
- allow(path, privilegesFromNames(new String[] {Privilege.JCR_ADD_CHILD_NODES, Privilege.JCR_NODE_TYPE_MANAGEMENT}));
- try {
- ((JackrabbitNode) child).rename("rename");
- testSession.save();
- fail("test session must not be allowed to rename nodes.");
- } catch (AccessDeniedException e) {
- // success.
- }
-
- // add 'remove_child_nodes' at 'path
- // -> rename of child must now succeed
- allow(path, privilegesFromName(Privilege.JCR_REMOVE_CHILD_NODES));
- ((JackrabbitNode) child).rename("rename");
- testSession.save();
- }
-
/**
* @see <a href="https://issues.apache.org/jira/browse/JCR-2420">JCR-2420</a>
*/