jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1455656 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak: core/ security/authorization/ security/privilege/ spi/commit/ spi/security/
Date Tue, 12 Mar 2013 18:17:17 GMT
Author: angela
Date: Tue Mar 12 18:17:16 2013
New Revision: 1455656

URL: http://svn.apache.org/r1455656
Log:
OAK-527: permissions (wip)

- align SecurityConfiguration#getSecurityHook with #getValidators: pass in workspace name
and consequently drop CommitHookProvider.

Removed:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/commit/CommitHookProvider.java
Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlConfigurationImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeConfigurationImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/SecurityConfiguration.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java?rev=1455656&r1=1455655&r2=1455656&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
Tue Mar 12 18:17:16 2013
@@ -296,16 +296,16 @@ public class RootImpl implements Root {
         commitHooks.add(hook);
         List<CommitHook> postValidationHooks = new ArrayList<CommitHook>();
         for (SecurityConfiguration sc : securityProvider.getSecurityConfigurations()) {
-            CommitHook ch = sc.getSecurityHooks().getCommitHook(workspaceName);
-            if (ch instanceof PostValidationHook) {
-                postValidationHooks.add(ch);
-            } else if (ch != EmptyHook.INSTANCE) {
-                commitHooks.add(ch);
+            for (CommitHook ch : sc.getCommitHooks(workspaceName)) {
+                if (ch instanceof PostValidationHook) {
+                    postValidationHooks.add(ch);
+                } else if (ch != EmptyHook.INSTANCE) {
+                    commitHooks.add(ch);
+                }
             }
             List<? extends ValidatorProvider> validators = sc.getValidators(workspaceName);
             if (!validators.isEmpty()) {
-                commitHooks.add(new EditorHook(
-                        CompositeEditorProvider.compose(validators)));
+                commitHooks.add(new EditorHook(CompositeEditorProvider.compose(validators)));
             }
         }
         commitHooks.addAll(postValidationHooks);

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlConfigurationImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlConfigurationImpl.java?rev=1455656&r1=1455655&r2=1455656&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlConfigurationImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlConfigurationImpl.java
Tue Mar 12 18:17:16 2013
@@ -23,15 +23,15 @@ import java.util.Set;
 import javax.annotation.Nonnull;
 import javax.jcr.security.AccessControlManager;
 
+import com.google.common.collect.ImmutableList;
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.namepath.NamePathMapper;
 import org.apache.jackrabbit.oak.plugins.version.VersionablePathHook;
+import org.apache.jackrabbit.oak.security.authorization.permission.PermissionHook;
 import org.apache.jackrabbit.oak.security.authorization.permission.PermissionStoreValidatorProvider;
 import org.apache.jackrabbit.oak.security.authorization.permission.PermissionValidatorProvider;
 import org.apache.jackrabbit.oak.security.authorization.restriction.RestrictionProviderImpl;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
-import org.apache.jackrabbit.oak.spi.commit.CommitHookProvider;
-import org.apache.jackrabbit.oak.spi.commit.CompositeHook;
 import org.apache.jackrabbit.oak.spi.commit.ValidatorProvider;
 import org.apache.jackrabbit.oak.spi.lifecycle.WorkspaceInitializer;
 import org.apache.jackrabbit.oak.spi.security.Context;
@@ -42,8 +42,6 @@ import org.apache.jackrabbit.oak.spi.sec
 import org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionProvider;
 import org.apache.jackrabbit.oak.spi.xml.ProtectedItemImporter;
 
-import com.google.common.collect.ImmutableList;
-
 /**
  * {@code AccessControlConfigurationImpl} ... TODO
  */
@@ -70,16 +68,10 @@ public class AccessControlConfigurationI
 
     @Nonnull
     @Override
-    public CommitHookProvider getSecurityHooks() {
-        return new CommitHookProvider() {
-            @Override
-            public CommitHook getCommitHook(String workspaceName) {
-//                return new CompositeHook(
-//                        new PermissionHook(workspaceName, getRestrictionProvider(NamePathMapper.DEFAULT)),
-//                        new VersionablePathHook(workspaceName));
-                return new CompositeHook(new VersionablePathHook(workspaceName));
-            }
-        };
+    public List<? extends CommitHook> getCommitHooks(String workspaceName) {
+        return ImmutableList.of(
+                new VersionablePathHook(workspaceName),
+                new PermissionHook(workspaceName, getRestrictionProvider(NamePathMapper.DEFAULT)));
     }
 
     @Override

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeConfigurationImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeConfigurationImpl.java?rev=1455656&r1=1455655&r2=1455656&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeConfigurationImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeConfigurationImpl.java
Tue Mar 12 18:17:16 2013
@@ -25,7 +25,6 @@ import org.apache.jackrabbit.api.securit
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.namepath.NamePathMapper;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
-import org.apache.jackrabbit.oak.spi.commit.CommitHookProvider;
 import org.apache.jackrabbit.oak.spi.commit.ValidatorProvider;
 import org.apache.jackrabbit.oak.spi.lifecycle.RepositoryInitializer;
 import org.apache.jackrabbit.oak.spi.security.Context;
@@ -53,13 +52,8 @@ public class PrivilegeConfigurationImpl 
     //----------------------------------------------< SecurityConfiguration >---
     @Nonnull
     @Override
-    public CommitHookProvider getSecurityHooks() {
-        return new CommitHookProvider() {
-            @Override
-            public CommitHook getCommitHook(String workspaceName) {
-                return new JcrAllCommitHook();
-            }
-        };
+    public List<? extends CommitHook> getCommitHooks(String workspaceName) {
+        return Collections.singletonList(new JcrAllCommitHook());
     }
 
     @Nonnull

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/SecurityConfiguration.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/SecurityConfiguration.java?rev=1455656&r1=1455655&r2=1455656&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/SecurityConfiguration.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/SecurityConfiguration.java
Tue Mar 12 18:17:16 2013
@@ -23,7 +23,6 @@ import javax.annotation.Nonnull;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
-import org.apache.jackrabbit.oak.spi.commit.CommitHookProvider;
 import org.apache.jackrabbit.oak.spi.commit.ValidatorProvider;
 import org.apache.jackrabbit.oak.spi.lifecycle.WorkspaceInitializer;
 import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
@@ -42,7 +41,7 @@ public interface SecurityConfiguration {
     WorkspaceInitializer getWorkspaceInitializer();
 
     @Nonnull
-    CommitHookProvider getSecurityHooks();
+    List<? extends CommitHook> getCommitHooks(String workspaceName);
 
     @Nonnull
     List<? extends ValidatorProvider> getValidators(String workspaceName);
@@ -78,8 +77,8 @@ public interface SecurityConfiguration {
 
         @Nonnull
         @Override
-        public CommitHookProvider getSecurityHooks() {
-            return new CommitHookProvider.Empty();
+        public List<? extends CommitHook> getCommitHooks(String workspaceName) {
+            return Collections.emptyList();
         }
 
         @Nonnull



Mime
View raw message