From 42b9eed5dcde89e1f2323efcdca0cbe859725631 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 9f6eb8a85b..af1cf79e1d 100644 --- a/apps/dav/lib/Connector/Sabre/ObjectTree.php +++ b/apps/dav/lib/Connector/Sabre/ObjectTree.php @@ -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.');