aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2023-05-10 15:20:56 +0200
committerRobin Appelman <robin@icewind.nl>2023-07-28 17:34:54 +0200
commit8af60b915bf9d8ece29d52f915c791d583b69f98 (patch)
tree9a94786c9f982edecdd67106d736504e3e581045 /lib
parentfda820a64d2b5d6eb542f58baf962ba21569400d (diff)
downloadnextcloud-server-8af60b915bf9d8ece29d52f915c791d583b69f98.tar.gz
nextcloud-server-8af60b915bf9d8ece29d52f915c791d583b69f98.zip
fix share roots always being marked as writable
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib')
-rw-r--r--lib/composer/composer/autoload_classmap.php1
-rw-r--r--lib/composer/composer/autoload_static.php1
-rw-r--r--lib/public/Files/DavUtil.php18
3 files changed, 18 insertions, 2 deletions
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php
index 89ae83e83e4..818d1865311 100644
--- a/lib/composer/composer/autoload_classmap.php
+++ b/lib/composer/composer/autoload_classmap.php
@@ -350,6 +350,7 @@ return array(
'OCP\\Files\\Lock\\OwnerLockedException' => $baseDir . '/lib/public/Files/Lock/OwnerLockedException.php',
'OCP\\Files\\Mount\\IMountManager' => $baseDir . '/lib/public/Files/Mount/IMountManager.php',
'OCP\\Files\\Mount\\IMountPoint' => $baseDir . '/lib/public/Files/Mount/IMountPoint.php',
+ 'OCP\\Files\\Mount\\IMovableMount' => $baseDir . '/lib/public/Files/Mount/IMovableMount.php',
'OCP\\Files\\Mount\\ISystemMountPoint' => $baseDir . '/lib/public/Files/Mount/ISystemMountPoint.php',
'OCP\\Files\\Node' => $baseDir . '/lib/public/Files/Node.php',
'OCP\\Files\\NotEnoughSpaceException' => $baseDir . '/lib/public/Files/NotEnoughSpaceException.php',
diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php
index 0480448a1b8..0e2afa8c8bd 100644
--- a/lib/composer/composer/autoload_static.php
+++ b/lib/composer/composer/autoload_static.php
@@ -383,6 +383,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OCP\\Files\\Lock\\OwnerLockedException' => __DIR__ . '/../../..' . '/lib/public/Files/Lock/OwnerLockedException.php',
'OCP\\Files\\Mount\\IMountManager' => __DIR__ . '/../../..' . '/lib/public/Files/Mount/IMountManager.php',
'OCP\\Files\\Mount\\IMountPoint' => __DIR__ . '/../../..' . '/lib/public/Files/Mount/IMountPoint.php',
+ 'OCP\\Files\\Mount\\IMovableMount' => __DIR__ . '/../../..' . '/lib/public/Files/Mount/IMovableMount.php',
'OCP\\Files\\Mount\\ISystemMountPoint' => __DIR__ . '/../../..' . '/lib/public/Files/Mount/ISystemMountPoint.php',
'OCP\\Files\\Node' => __DIR__ . '/../../..' . '/lib/public/Files/Node.php',
'OCP\\Files\\NotEnoughSpaceException' => __DIR__ . '/../../..' . '/lib/public/Files/NotEnoughSpaceException.php',
diff --git a/lib/public/Files/DavUtil.php b/lib/public/Files/DavUtil.php
index 343f3c2ac0f..cc2055d6750 100644
--- a/lib/public/Files/DavUtil.php
+++ b/lib/public/Files/DavUtil.php
@@ -32,6 +32,9 @@
namespace OCP\Files;
+use OCP\Constants;
+use OCP\Files\Mount\IMovableMount;
+
/**
* 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 IMovableMount) {
+ $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 {