jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1513523 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr: SessionContext.java SessionImpl.java security/AccessManager.java
Date Tue, 13 Aug 2013 14:53:58 GMT
Author: mduerig
Date: Tue Aug 13 14:53:57 2013
New Revision: 1513523

URL: http://svn.apache.org/r1513523
Log:
OAK-958: Session related entities do not honour session refresh settings
Wrap AccessManager

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/AccessManager.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java?rev=1513523&r1=1513522&r2=1513523&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionContext.java
Tue Aug 13 14:53:57 2013
@@ -309,7 +309,7 @@ public class SessionContext implements N
 
     @Nonnull
     public AccessManager getAccessManager() throws RepositoryException {
-        return new AccessManager(delegate.getPermissionProvider());
+        return new AccessManager(delegate);
     }
 
     @Nonnull

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java?rev=1513523&r1=1513522&r2=1513523&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
Tue Aug 13 14:53:57 2013
@@ -401,7 +401,7 @@ public class SessionImpl implements Jack
     public void refresh(final boolean keepChanges) throws RepositoryException {
         perform(new WriteOperation<Void>() {
             @Override
-            public Void perform() throws RepositoryException {
+            public Void perform() {
                 sd.refresh(keepChanges);
                 return null;
             }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/AccessManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/AccessManager.java?rev=1513523&r1=1513522&r2=1513523&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/AccessManager.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/AccessManager.java
Tue Aug 13 14:53:57 2013
@@ -23,25 +23,38 @@ import javax.jcr.RepositoryException;
 
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Tree;
+import org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate;
+import org.apache.jackrabbit.oak.jcr.operation.SessionOperation;
 import org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider;
 
 /**
  * AccessManager
  */
 public class AccessManager {
-
+    private final SessionDelegate delegate;
     private final PermissionProvider permissionProvider;
 
-    public AccessManager(@Nonnull PermissionProvider permissionProvider) {
-        this.permissionProvider = permissionProvider;
+    public AccessManager(SessionDelegate delegate) {
+        this.delegate = delegate;
+        this.permissionProvider = delegate.getPermissionProvider();
     }
 
-    public boolean hasPermissions(@Nonnull String oakPath, @Nonnull String actions) {
-        return permissionProvider.isGranted(oakPath, actions);
+    public boolean hasPermissions(@Nonnull final String oakPath, @Nonnull final String actions)
{
+        return delegate.safePerform(new SessionOperation<Boolean>() {
+            @Override
+            public Boolean perform() {
+                return permissionProvider.isGranted(oakPath, actions);
+            }
+        });
     }
 
-    public boolean hasPermissions(@Nonnull Tree tree, @Nullable PropertyState property, long
permissions) throws RepositoryException {
-        return permissionProvider.isGranted(tree, property, permissions);
+    public boolean hasPermissions(@Nonnull final Tree tree, @Nullable final PropertyState
property, final long permissions) throws RepositoryException {
+        return delegate.safePerform(new SessionOperation<Boolean>() {
+            @Override
+            public Boolean perform() {
+                return permissionProvider.isGranted(tree, property, permissions);
+            }
+        });
     }
 
     public void checkPermissions(@Nonnull String oakPath, @Nonnull String actions) throws
RepositoryException {



Mime
View raw message