summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2016-09-07 11:10:48 +0200
committerJoas Schilling <coding@schilljs.com>2016-09-08 09:41:58 +0200
commit338ce725c70e17aa4d9fccce5a9e926098fa101c (patch)
tree3d39eba3b07eb43ffdd28c1523006fdd943aee0a /apps
parent83515c90e9d48f00aa1ebd5794cda243ac9006b4 (diff)
downloadnextcloud-server-338ce725c70e17aa4d9fccce5a9e926098fa101c.tar.gz
nextcloud-server-338ce725c70e17aa4d9fccce5a9e926098fa101c.zip
Only require CREATE permissions when the file does not exist yet
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/lib/connector/sabre/objecttree.php13
1 files changed, 11 insertions, 2 deletions
diff --git a/apps/dav/lib/connector/sabre/objecttree.php b/apps/dav/lib/connector/sabre/objecttree.php
index 24ce4acdf22..adf55f81bb0 100644
--- a/apps/dav/lib/connector/sabre/objecttree.php
+++ b/apps/dav/lib/connector/sabre/objecttree.php
@@ -202,7 +202,11 @@ class ObjectTree extends \Sabre\DAV\Tree {
$infoDestination = $this->fileView->getFileInfo(dirname($destinationPath));
$infoSource = $this->fileView->getFileInfo($sourcePath);
- $destinationPermission = $infoDestination && $infoDestination->isUpdateable();
+ if ($this->fileView->file_exists($destinationPath)) {
+ $destinationPermission = $infoDestination && $infoDestination->isUpdateable();
+ } else {
+ $destinationPermission = $infoDestination && $infoDestination->isCreatable();
+ }
$sourcePermission = $infoSource && $infoSource->isDeletable();
if (!$destinationPermission || !$sourcePermission) {
@@ -292,7 +296,12 @@ class ObjectTree extends \Sabre\DAV\Tree {
}
$info = $this->fileView->getFileInfo(dirname($destination));
- if ($info && !$info->isUpdateable()) {
+ if ($this->fileView->file_exists($destination)) {
+ $destinationPermission = $info && $info->isUpdateable();
+ } else {
+ $destinationPermission = $info && $info->isCreatable();
+ }
+ if (!$destinationPermission) {
throw new Forbidden('No permissions to copy object.');
}