jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1396619 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/ oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/
Date Wed, 10 Oct 2012 14:31:52 GMT
Author: angela
Date: Wed Oct 10 14:31:52 2012
New Revision: 1396619

URL: http://svn.apache.org/viewvc?rev=1396619&view=rev
Log:
OAK-64 : Privilege Management (WIP)

- make jcr:read aggregate

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeConstants.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeRegistry.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/AbstractPrivilegeTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/PrivilegeManagerImplTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeConstants.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeConstants.java?rev=1396619&r1=1396618&r2=1396619&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeConstants.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeConstants.java
Wed Oct 10 14:31:52 2012
@@ -54,19 +54,28 @@ public interface PrivilegeConstants {
 
     String REP_PRIVILEGE_MANAGEMENT = "rep:privilegeManagement";
     String REP_WRITE = "rep:write";
+    String REP_READ_NODES = "rep:readNodes";
+    String REP_READ_PROPERTIES = "rep:readProperties";
     String REP_ADD_PROPERTIES = "rep:addProperties";
     String REP_ALTER_PROPERTIES = "rep:alterProperties";
     String REP_REMOVE_PROPERTIES = "rep:removeProperties";
 
     String[] NON_AGGR_PRIVILEGES = new String[] {
-            JCR_READ, REP_ADD_PROPERTIES, REP_ALTER_PROPERTIES, REP_REMOVE_PROPERTIES,
+            REP_READ_NODES, REP_READ_PROPERTIES,
+            REP_ADD_PROPERTIES, REP_ALTER_PROPERTIES, REP_REMOVE_PROPERTIES,
             JCR_ADD_CHILD_NODES, JCR_REMOVE_CHILD_NODES, JCR_REMOVE_NODE,
             JCR_READ_ACCESS_CONTROL, JCR_MODIFY_ACCESS_CONTROL, JCR_NODE_TYPE_MANAGEMENT,
             JCR_VERSION_MANAGEMENT, JCR_LOCK_MANAGEMENT, JCR_LIFECYCLE_MANAGEMENT,
             JCR_RETENTION_MANAGEMENT, JCR_WORKSPACE_MANAGEMENT, JCR_NODE_TYPE_DEFINITION_MANAGEMENT,
             JCR_NAMESPACE_MANAGEMENT, REP_PRIVILEGE_MANAGEMENT};
 
-    String[] AGGR_PRIVILEGES = new String[] {JCR_MODIFY_PROPERTIES, JCR_WRITE, REP_WRITE};
+    String[] AGGR_PRIVILEGES = new String[] {
+            JCR_READ, JCR_MODIFY_PROPERTIES, JCR_WRITE, REP_WRITE
+    };
+
+    String[] AGGR_JCR_READ = new String[] {
+            REP_READ_NODES, REP_READ_PROPERTIES
+    };
 
     String[] AGGR_JCR_MODIFY_PROPERTIES = new String[] {
             REP_ADD_PROPERTIES, REP_ALTER_PROPERTIES, REP_REMOVE_PROPERTIES

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeRegistry.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeRegistry.java?rev=1396619&r1=1396618&r2=1396619&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeRegistry.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeRegistry.java
Wed Oct 10 14:31:52 2012
@@ -44,6 +44,7 @@ public class PrivilegeRegistry implement
 
     private static final Map<String, String[]> AGGREGATE_PRIVILEGES = new HashMap<String,String[]>();
     static {
+        AGGREGATE_PRIVILEGES.put(JCR_READ, AGGR_JCR_READ);
         AGGREGATE_PRIVILEGES.put(JCR_MODIFY_PROPERTIES, AGGR_JCR_MODIFY_PROPERTIES);
         AGGREGATE_PRIVILEGES.put(JCR_WRITE, AGGR_JCR_WRITE);
         AGGREGATE_PRIVILEGES.put(REP_WRITE, AGGR_REP_WRITE);

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/AbstractPrivilegeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/AbstractPrivilegeTest.java?rev=1396619&r1=1396618&r2=1396619&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/AbstractPrivilegeTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/AbstractPrivilegeTest.java
Wed Oct 10 14:31:52 2012
@@ -27,7 +27,7 @@ import org.apache.jackrabbit.oak.securit
 import org.apache.jackrabbit.test.AbstractJCRTest;
 
 /**
- * AbstractPrivilegeTest... TODO
+ * Base class for privilege management tests.
  */
 abstract class AbstractPrivilegeTest extends AbstractJCRTest implements PrivilegeConstants
{
 

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/PrivilegeManagerImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/PrivilegeManagerImplTest.java?rev=1396619&r1=1396618&r2=1396619&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/PrivilegeManagerImplTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/PrivilegeManagerImplTest.java
Wed Oct 10 14:31:52 2012
@@ -103,6 +103,8 @@ public class PrivilegeManagerImplTest ex
         assertTrue(aggr.remove(privilegeManager.getPrivilege(Privilege.JCR_VERSION_MANAGEMENT)));
         assertTrue(aggr.remove(privilegeManager.getPrivilege(Privilege.JCR_WRITE)));
         assertTrue(aggr.remove(privilegeManager.getPrivilege(PrivilegeConstants.REP_WRITE)));
+        assertTrue(aggr.remove(privilegeManager.getPrivilege(PrivilegeConstants.REP_READ_NODES)));
+        assertTrue(aggr.remove(privilegeManager.getPrivilege(PrivilegeConstants.REP_READ_PROPERTIES)));
         assertTrue(aggr.remove(privilegeManager.getPrivilege(PrivilegeConstants.REP_ADD_PROPERTIES)));
         assertTrue(aggr.remove(privilegeManager.getPrivilege(PrivilegeConstants.REP_ALTER_PROPERTIES)));
         assertTrue(aggr.remove(privilegeManager.getPrivilege(PrivilegeConstants.REP_REMOVE_PROPERTIES)));
@@ -117,16 +119,16 @@ public class PrivilegeManagerImplTest ex
 
     @Test
     public void testGetPrivilegeFromName() throws AccessControlException, RepositoryException
{
-        Privilege p = privilegeManager.getPrivilege(Privilege.JCR_READ);
+        Privilege p = privilegeManager.getPrivilege(Privilege.JCR_VERSION_MANAGEMENT);
 
         assertTrue(p != null);
-        assertEquals("jcr:read", p.getName());
+        assertEquals(PrivilegeConstants.JCR_VERSION_MANAGEMENT, p.getName());
         assertFalse(p.isAggregate());
 
         p = privilegeManager.getPrivilege(Privilege.JCR_WRITE);
 
         assertTrue(p != null);
-        assertEquals("jcr:write", p.getName());
+        assertEquals(PrivilegeConstants.JCR_WRITE, p.getName());
         assertTrue(p.isAggregate());
     }
 



Mime
View raw message