jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r698210 - in /jackrabbit/branches/1.4/jackrabbit-core: ./ JCR-1743-alternative.patch JCR-1743.patch src/main/java/org/apache/jackrabbit/core/util/DOMWalker.java src/test/java/org/apache/jackrabbit/core/util/DOMWalkerTest.java
Date Tue, 23 Sep 2008 16:00:27 GMT
Author: jukka
Date: Tue Sep 23 09:00:27 2008
New Revision: 698210

URL: http://svn.apache.org/viewvc?rev=698210&view=rev
Log:
1.4: Merged revision 698209 (JCR-1755)

Added:
    jackrabbit/branches/1.4/jackrabbit-core/JCR-1743-alternative.patch   (with props)
    jackrabbit/branches/1.4/jackrabbit-core/JCR-1743.patch   (with props)
    jackrabbit/branches/1.4/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/util/DOMWalkerTest.java
      - copied unchanged from r698209, jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/util/DOMWalkerTest.java
Modified:
    jackrabbit/branches/1.4/jackrabbit-core/   (props changed)
    jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/DOMWalker.java

Propchange: jackrabbit/branches/1.4/jackrabbit-core/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Sep 23 09:00:27 2008
@@ -1 +1 @@
-/jackrabbit/trunk/jackrabbit-core:653417,654078,654514,655917,656240,656655,656664,658583,668147,672125,678788,679389,680135,681031,681287,682409,686688,691181,691550,694164,698200
+/jackrabbit/trunk/jackrabbit-core:653417,654078,654514,655917,656240,656655,656664,658583,668147,672125,678788,679389,680135,681031,681287,682409,686688,691181,691550,694164,698200,698209

Added: jackrabbit/branches/1.4/jackrabbit-core/JCR-1743-alternative.patch
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/JCR-1743-alternative.patch?rev=698210&view=auto
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-core/JCR-1743-alternative.patch (added)
+++ jackrabbit/branches/1.4/jackrabbit-core/JCR-1743-alternative.patch Tue Sep 23 09:00:27
2008
@@ -0,0 +1,46 @@
+Index: src/main/java/org/apache/jackrabbit/core/SessionImpl.java
+===================================================================
+--- src/main/java/org/apache/jackrabbit/core/SessionImpl.java	(revision 698201)
++++ src/main/java/org/apache/jackrabbit/core/SessionImpl.java	(working copy)
+@@ -752,7 +752,8 @@
+             try {
+                 if (targetId == null) {
+                     targetId = hierMgr.resolvePath(targetPath);
+-                    if (targetId == null) {
++
++                    if (targetId == null || targetId.denotesNode()) {
+                         // property does not exist yet,
+                         // check WRITE permission on parent
+                         if (parentPath == null) {
+@@ -760,12 +761,29 @@
+                         }
+                         if (parentId == null) {
+                             parentId = hierMgr.resolveNodePath(parentPath);
+-                            if (parentId == null) {
++                            if (parentId == null || !parentId.denotesNode()) {
+                                 // parent does not exist, throw exception
+                                 throw new AccessControlException(SET_PROPERTY_ACTION);
+                             }
+                         }
+-                        accessMgr.checkPermission(parentId, AccessManager.WRITE);
++
++                        // JCR-1743: Session.checkPermission: add_node and
++                        // set_property evaluation are not handled differently
++                        //
++                        // Generate a virtual property id (that does not map
++                        // to an existing item) and use that to check WRITE
++                        // permission.
++                        Name name = targetPath.getNameElement().getName();
++                        targetId = new PropertyId((NodeId) parentId, name);
++                        try {
++                            accessMgr.checkPermission(targetId, AccessManager.WRITE);
++                        } catch (ItemNotFoundException e) {
++                            // The AccessManager implementation expects the
++                            // target item to exist. Fall back to previous
++                            // behaviour and ask for WRITE permission on the
++                            // parent node
++                            accessMgr.checkPermission(parentId, AccessManager.WRITE);
++                        }
+                     } else {
+                         // property does already exist,
+                         // check WRITE permission on target

Propchange: jackrabbit/branches/1.4/jackrabbit-core/JCR-1743-alternative.patch
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/branches/1.4/jackrabbit-core/JCR-1743.patch
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/JCR-1743.patch?rev=698210&view=auto
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-core/JCR-1743.patch (added)
+++ jackrabbit/branches/1.4/jackrabbit-core/JCR-1743.patch Tue Sep 23 09:00:27 2008
@@ -0,0 +1,44 @@
+Index: src/main/java/org/apache/jackrabbit/core/SessionImpl.java
+===================================================================
+--- src/main/java/org/apache/jackrabbit/core/SessionImpl.java	(revision 698201)
++++ src/main/java/org/apache/jackrabbit/core/SessionImpl.java	(working copy)
+@@ -752,7 +752,8 @@
+             try {
+                 if (targetId == null) {
+                     targetId = hierMgr.resolvePath(targetPath);
+-                    if (targetId == null) {
++
++                    if (targetId == null || targetId.denotesNode()) {
+                         // property does not exist yet,
+                         // check WRITE permission on parent
+                         if (parentPath == null) {
+@@ -760,17 +761,23 @@
+                         }
+                         if (parentId == null) {
+                             parentId = hierMgr.resolveNodePath(parentPath);
+-                            if (parentId == null) {
++                            if (parentId == null || !parentId.denotesNode()) {
+                                 // parent does not exist, throw exception
+                                 throw new AccessControlException(SET_PROPERTY_ACTION);
+                             }
+                         }
+-                        accessMgr.checkPermission(parentId, AccessManager.WRITE);
+-                    } else {
+-                        // property does already exist,
+-                        // check WRITE permission on target
+-                        accessMgr.checkPermission(targetId, AccessManager.WRITE);
++
++                        // JCR-1743: Session.checkPermission: add_node and
++                        // set_property evaluation are not handled differently
++                        //
++                        // Generate a virtual property id (that does not map
++                        // to an existing item) and use that to check WRITE
++                        // permission.
++                        Name name = targetPath.getNameElement().getName();
++                        targetId = new PropertyId((NodeId) parentId, name);
+                     }
++
++                    accessMgr.checkPermission(targetId, AccessManager.WRITE);
+                 }
+             } catch (AccessDeniedException re) {
+                 // otherwise the RepositoryException catch clause will

Propchange: jackrabbit/branches/1.4/jackrabbit-core/JCR-1743.patch
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/DOMWalker.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/DOMWalker.java?rev=698210&r1=698209&r2=698210&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/DOMWalker.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/util/DOMWalker.java
Tue Sep 23 09:00:27 2008
@@ -212,7 +212,10 @@
         }
 
         if (name.equals(current.getNodeName())) {
-            current = (Element) current.getParentNode();
+            Node parent = current.getParentNode();
+            if (parent instanceof Element) {
+                current = (Element) parent;
+            }
         }
         return false;
     }



Mime
View raw message