From a69fe583f847e7e8d8ab1fd5cb07d528627df343 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 7 Sep 2016 11:22:57 +0200 Subject: [PATCH] UPDATE permissions qualify for renaming a node --- apps/dav/lib/connector/sabre/objecttree.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/apps/dav/lib/connector/sabre/objecttree.php b/apps/dav/lib/connector/sabre/objecttree.php index adf55f81bb0..da17f1a268d 100644 --- a/apps/dav/lib/connector/sabre/objecttree.php +++ b/apps/dav/lib/connector/sabre/objecttree.php @@ -201,13 +201,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.');