summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2016-09-07 11:22:57 +0200
committerJoas Schilling <coding@schilljs.com>2016-09-07 11:22:57 +0200
commitcf69a2b7eb06eb3e1894e73441d8877aac1e51f6 (patch)
tree4299fefd0d9b07fa626f4301b6ece7818102e0f2 /apps/dav/lib
parent4c0665b6ecff6e056de9020ee5d78b73a60134d1 (diff)
downloadnextcloud-server-cf69a2b7eb06eb3e1894e73441d8877aac1e51f6.tar.gz
nextcloud-server-cf69a2b7eb06eb3e1894e73441d8877aac1e51f6.zip
UPDATE permissions qualify for renaming a node
Diffstat (limited to 'apps/dav/lib')
-rw-r--r--apps/dav/lib/Connector/Sabre/ObjectTree.php15
1 files changed, 10 insertions, 5 deletions
diff --git a/apps/dav/lib/Connector/Sabre/ObjectTree.php b/apps/dav/lib/Connector/Sabre/ObjectTree.php
index 9f6eb8a85b0..af1cf79e1db 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.');