jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1085070 - in /jackrabbit/trunk/jackrabbit-core/src: main/java/org/apache/jackrabbit/core/security/user/ test/java/org/apache/jackrabbit/api/security/user/ test/java/org/apache/jackrabbit/core/security/user/
Date Thu, 24 Mar 2011 18:52:29 GMT
Author: angela
Date: Thu Mar 24 18:52:29 2011
New Revision: 1085070

URL: http://svn.apache.org/viewvc?rev=1085070&view=rev
Log:
JCR-2931 : Compatibility issue if admin impersonates admin session

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/ImpersonationImpl.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/ImpersonationTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/ImpersonationImplTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/ImpersonationImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/ImpersonationImpl.java?rev=1085070&r1=1085069&r2=1085070&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/ImpersonationImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/ImpersonationImpl.java
Thu Mar 24 18:52:29 2011
@@ -149,10 +149,7 @@ class ImpersonationImpl implements Imper
                     continue;
                 }
                 Authorizable a = userManager.getAuthorizable(p);
-                if (user.equals(a)) {
-                    allows = false;
-                    break;
-                } else if (a != null && userManager.isAdminId(a.getID())) {
+                if (a != null && userManager.isAdminId(a.getID())) {
                     allows = true;
                     break;
                 }

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/ImpersonationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/ImpersonationTest.java?rev=1085070&r1=1085069&r2=1085070&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/ImpersonationTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/ImpersonationTest.java
Thu Mar 24 18:52:29 2011
@@ -195,6 +195,15 @@ public class ImpersonationTest extends A
         assertFalse(impersonation.allows(subject));
     }
 
+    /**
+     * @see <a href="https://issues.apache.org/jira/browse/JCR-2931">JCR-2931</a>
+     */
+    public void testAdminImpersonatingOneself() throws RepositoryException, NotExecutableException
{
+        User admin = getTestUser(superuser);
+        Subject subject = createSubject(admin);
+        assertTrue(admin.getImpersonation().allows(subject));
+    }
+
     public void testGrantImpersonatingForOneself() throws RepositoryException {
         Principal main = newUser.getPrincipal();
         try {

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/ImpersonationImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/ImpersonationImplTest.java?rev=1085070&r1=1085069&r2=1085070&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/ImpersonationImplTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/ImpersonationImplTest.java
Thu Mar 24 18:52:29 2011
@@ -144,12 +144,11 @@ public class ImpersonationImplTest exten
         assertTrue(impersonation.allows(buildSubject(adminPrincipal)));
 
         // same if the impersonation object of the admin itself is used.
-        // however impersonation is not allowed....
         Impersonation adminImpersonation = ((User) a).getImpersonation();
 
         assertFalse(adminImpersonation.grantImpersonation(adminPrincipal));
         assertFalse(adminImpersonation.revokeImpersonation(adminPrincipal));
-        assertFalse(adminImpersonation.allows(buildSubject(adminPrincipal)));
+        assertTrue(impersonation.allows(buildSubject(adminPrincipal)));
     }
 
     public void testSystemPrincipalAsImpersonator() throws RepositoryException {



Mime
View raw message