summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAndy Scherzinger <info@andy-scherzinger.de>2023-08-01 16:53:18 +0200
committerGitHub <noreply@github.com>2023-08-01 16:53:18 +0200
commit46da23f0188ece6fb2ee352545191b8c68f00061 (patch)
tree52b0f41869892b31993632a39420d50424666efc /lib
parent59fe990632d0e6d66f2cbaac3477df5f9ae6f539 (diff)
parent2fe6370923cb4b052d7472681a2c6a254f4c6892 (diff)
downloadnextcloud-server-46da23f0188ece6fb2ee352545191b8c68f00061.tar.gz
nextcloud-server-46da23f0188ece6fb2ee352545191b8c68f00061.zip
Merge pull request #39614 from nextcloud/dav-permissions-share-root-write-27
[27] fix share roots always being marked as writable
Diffstat (limited to 'lib')
-rw-r--r--lib/public/Files/DavUtil.php18
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/public/Files/DavUtil.php b/lib/public/Files/DavUtil.php
index 343f3c2ac0f..2e7efdccd07 100644
--- a/lib/public/Files/DavUtil.php
+++ b/lib/public/Files/DavUtil.php
@@ -32,6 +32,9 @@
namespace OCP\Files;
+use OCP\Constants;
+use OC\Files\Mount\MoveableMount;
+
/**
* This class provides different helper functions related to WebDAV protocol
*
@@ -73,10 +76,21 @@ class DavUtil {
$p .= 'D';
}
if ($info->isUpdateable()) {
- $p .= 'NV'; // Renameable, Moveable
+ $p .= 'NV'; // Renameable, Movable
}
+
+ // since we always add update permissions for the root of movable mounts
+ // we need to check the shared cache item directly to determine if it's writable
+ $storage = $info->getStorage();
+ if ($info->getInternalPath() === '' && $info->getMountPoint() instanceof MoveableMount) {
+ $rootEntry = $storage->getCache()->get('');
+ $isWritable = $rootEntry->getPermissions() & Constants::PERMISSION_UPDATE;
+ } else {
+ $isWritable = $info->isUpdateable();
+ }
+
if ($info->getType() === FileInfo::TYPE_FILE) {
- if ($info->isUpdateable()) {
+ if ($isWritable) {
$p .= 'W';
}
} else {