aboutsummaryrefslogtreecommitdiffstats
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-07 11:10:48 +0200
commit4c0665b6ecff6e056de9020ee5d78b73a60134d1 (patch)
tree9d824aeb62905cd80b6e80f48ff1f6d32bf86e90 /apps
parent0027304b5fc0a92106dca948b72b6fad04b91299 (diff)
downloadnextcloud-server-4c0665b6ecff6e056de9020ee5d78b73a60134d1.tar.gz
nextcloud-server-4c0665b6ecff6e056de9020ee5d78b73a60134d1.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 e872ea58279..9f6eb8a85b0 100644
--- a/apps/dav/lib/Connector/Sabre/ObjectTree.php
+++ b/apps/dav/lib/Connector/Sabre/ObjectTree.php
@@ -205,7 +205,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) {
@@ -298,7 +302,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.');
}