diff options
-rw-r--r-- | lib/private/Files/FileInfo.php | 22 | ||||
-rw-r--r-- | lib/public/Files/DavUtil.php | 13 |
2 files changed, 12 insertions, 23 deletions
diff --git a/lib/private/Files/FileInfo.php b/lib/private/Files/FileInfo.php index 2b6b83a2546..3937ee16a7c 100644 --- a/lib/private/Files/FileInfo.php +++ b/lib/private/Files/FileInfo.php @@ -32,7 +32,9 @@ */ namespace OC\Files; +use OCA\Files_Sharing\ISharedStorage; use OCP\Files\Cache\ICacheEntry; +use OCP\Files\IHomeStorage; use OCP\Files\Mount\IMountPoint; use OCP\IUser; @@ -313,27 +315,13 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { * @return bool */ public function isShared() { - $sid = $this->getStorage()->getId(); - if (!is_null($sid)) { - $sid = explode(':', $sid); - return ($sid[0] === 'shared'); - } - - return false; + $storage = $this->getStorage(); + return $storage->instanceOfStorage(ISharedStorage::class); } public function isMounted() { $storage = $this->getStorage(); - if ($storage->instanceOfStorage('\OCP\Files\IHomeStorage')) { - return false; - } - $sid = $storage->getId(); - if (!is_null($sid)) { - $sid = explode(':', $sid); - return ($sid[0] !== 'home' and $sid[0] !== 'shared'); - } - - return false; + return !($storage->instanceOfStorage(IHomeStorage::class) || $storage->instanceOfStorage(ISharedStorage::class)); } /** diff --git a/lib/public/Files/DavUtil.php b/lib/public/Files/DavUtil.php index cc2055d6750..89fd3b18643 100644 --- a/lib/public/Files/DavUtil.php +++ b/lib/public/Files/DavUtil.php @@ -59,23 +59,24 @@ class DavUtil { * @since 25.0.0 */ public static function getDavPermissions(FileInfo $info): string { + $permissions = $info->getPermissions(); $p = ''; if ($info->isShared()) { $p .= 'S'; } - if ($info->isShareable()) { + if ($permissions & Constants::PERMISSION_SHARE) { $p .= 'R'; } if ($info->isMounted()) { $p .= 'M'; } - if ($info->isReadable()) { + if ($permissions & Constants::PERMISSION_READ) { $p .= 'G'; } - if ($info->isDeletable()) { + if ($permissions & Constants::PERMISSION_DELETE) { $p .= 'D'; } - if ($info->isUpdateable()) { + if ($permissions & Constants::PERMISSION_UPDATE) { $p .= 'NV'; // Renameable, Movable } @@ -86,7 +87,7 @@ class DavUtil { $rootEntry = $storage->getCache()->get(''); $isWritable = $rootEntry->getPermissions() & Constants::PERMISSION_UPDATE; } else { - $isWritable = $info->isUpdateable(); + $isWritable = $permissions & Constants::PERMISSION_UPDATE; } if ($info->getType() === FileInfo::TYPE_FILE) { @@ -94,7 +95,7 @@ class DavUtil { $p .= 'W'; } } else { - if ($info->isCreatable()) { + if ($permissions & Constants::PERMISSION_CREATE) { $p .= 'CK'; } } |