]> source.dussan.org Git - nextcloud-server.git/commitdiff
UPDATE permissions qualify for renaming a node
authorJoas Schilling <coding@schilljs.com>
Wed, 7 Sep 2016 09:22:57 +0000 (11:22 +0200)
committerJoas Schilling <coding@schilljs.com>
Wed, 7 Sep 2016 09:22:57 +0000 (11:22 +0200)
apps/dav/lib/Connector/Sabre/ObjectTree.php

index 9f6eb8a85b01dae33e1c2626c680d3c382328690..af1cf79e1db66df642c9776b1b945758806f1641 100644 (file)
@@ -204,13 +204,18 @@ class ObjectTree extends \Sabre\DAV\Tree {
                }
 
                $infoDestination = $this->fileView->getFileInfo(dirname($destinationPath));
-               $infoSource = $this->fileView->getFileInfo($sourcePath);
-               if ($this->fileView->file_exists($destinationPath)) {
-                       $destinationPermission = $infoDestination && $infoDestination->isUpdateable();
+               if (dirname($destinationPath) === dirname($sourcePath)) {
+                       $sourcePermission = $infoDestination && $infoDestination->isUpdateable();
+                       $destinationPermission = $sourcePermission;
                } else {
-                       $destinationPermission = $infoDestination && $infoDestination->isCreatable();
+                       $infoSource = $this->fileView->getFileInfo($sourcePath);
+                       if ($this->fileView->file_exists($destinationPath)) {
+                               $destinationPermission = $infoDestination && $infoDestination->isUpdateable();
+                       } else {
+                               $destinationPermission = $infoDestination && $infoDestination->isCreatable();
+                       }
+                       $sourcePermission =  $infoSource && $infoSource->isDeletable();
                }
-               $sourcePermission =  $infoSource && $infoSource->isDeletable();
 
                if (!$destinationPermission || !$sourcePermission) {
                        throw new Forbidden('No permissions to move object.');