jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r1141141 - in /jackrabbit/trunk/jackrabbit-core/src: main/java/org/apache/jackrabbit/core/PropertyImpl.java test/java/org/apache/jackrabbit/core/security/authorization/AbstractWriteTest.java
Date Wed, 29 Jun 2011 15:54:29 GMT
Author: stefan
Date: Wed Jun 29 15:54:28 2011
New Revision: 1141141

URL: http://svn.apache.org/viewvc?rev=1141141&view=rev
Log:
JCR-3007: setProperty access control evaluation does not properly cope with XA transactions

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/PropertyImpl.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/AbstractWriteTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/PropertyImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/PropertyImpl.java?rev=1141141&r1=1141140&r2=1141141&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/PropertyImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/PropertyImpl.java
Wed Jun 29 15:54:28 2011
@@ -258,7 +258,7 @@ public class PropertyImpl extends ItemIm
             throws ValueFormatException, VersionException,
             LockException, ConstraintViolationException,
             RepositoryException {
-        NodeImpl parent = (NodeImpl) getParent();
+        NodeImpl parent = (NodeImpl) getParent(false);
         // check multi-value flag
         if (multipleValues != isMultiple()) {
             String msg = (multipleValues) ?
@@ -327,6 +327,10 @@ public class PropertyImpl extends ItemIm
         thisState.setType(type);
     }
 
+    protected Node getParent(boolean checkPermission) throws RepositoryException {
+        return (Node) itemMgr.getItem(getPropertyState().getParentId(), checkPermission);
+    }
+
     /**
      * Same as <code>{@link Property#setValue(String)}</code> except that
      * this method takes a <code>Name</code> instead of a <code>String</code>
@@ -893,7 +897,7 @@ public class PropertyImpl extends ItemIm
      * {@inheritDoc}
      */
     public Node getParent() throws RepositoryException {
-        return (Node) itemMgr.getItem(getPropertyState().getParentId());
+        return getParent(true);
     }
 
     //--------------------------------------------------------------< Object >

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/AbstractWriteTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/AbstractWriteTest.java?rev=1141141&r1=1141140&r2=1141141&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/AbstractWriteTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/AbstractWriteTest.java
Wed Jun 29 15:54:28 2011
@@ -1298,6 +1298,11 @@ public abstract class AbstractWriteTest 
         n2 = n.addNode(nodeName1);
         s.save();
 
+        // set a property on a child node of an uncommited parent
+        n2.setProperty(propertyName1, "testSetProperty");
+        s.save();  // -> used to fail because PropertyImpl#getParent called from PropertyImpl#checkSetValue
+                   //    was checking read permission on the not yet commited parent
+
         // commit
         utx.commit();
     }
@@ -1315,4 +1320,4 @@ public abstract class AbstractWriteTest 
         }
         return policyNode;
     }
-}
\ No newline at end of file
+}



Mime
View raw message