aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorprovokateurin <kate@provokateurin.de>2024-09-26 09:41:49 +0200
committerprovokateurin <kate@provokateurin.de>2024-09-26 14:34:44 +0200
commit5d4a358cc44aa31ba98d0861c4d79914df53c2f5 (patch)
tree9587b6a9e700e39d8d1629b7eea6f7135759f8e1 /apps
parentadc38a724899b9bd69a0920011f9f83b077200a2 (diff)
downloadnextcloud-server-5d4a358cc44aa31ba98d0861c4d79914df53c2f5.tar.gz
nextcloud-server-5d4a358cc44aa31ba98d0861c4d79914df53c2f5.zip
refactor(files_sharing): Make permissions prop checks less error prone
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/lib/External/Storage.php15
1 files changed, 9 insertions, 6 deletions
diff --git a/apps/files_sharing/lib/External/Storage.php b/apps/files_sharing/lib/External/Storage.php
index 53d25b6b1bc..38b7a29e366 100644
--- a/apps/files_sharing/lib/External/Storage.php
+++ b/apps/files_sharing/lib/External/Storage.php
@@ -345,14 +345,17 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage,
public function getPermissions($path): int {
$response = $this->propfind($path);
+ $ocsPermissions = $response['{http://open-collaboration-services.org/ns}share-permissions'] ?? null;
+ $ocmPermissions = $response['{http://open-cloud-mesh.org/ns}share-permissions'] ?? null;
+ $ocPermissions = $response['{http://owncloud.org/ns}permissions'] ?? null;
// old federated sharing permissions
- if (isset($response['{http://open-collaboration-services.org/ns}share-permissions'])) {
- $permissions = (int)$response['{http://open-collaboration-services.org/ns}share-permissions'];
- } elseif (isset($response['{http://open-cloud-mesh.org/ns}share-permissions'])) {
+ if ($ocsPermissions !== null) {
+ $permissions = (int)$ocsPermissions;
+ } elseif ($ocmPermissions !== null) {
// permissions provided by the OCM API
- $permissions = $this->ocmPermissions2ncPermissions($response['{http://open-cloud-mesh.org/ns}share-permissions'], $path);
- } elseif (isset($response['{http://owncloud.org/ns}permissions'])) {
- return $this->parsePermissions($response['{http://owncloud.org/ns}permissions']);
+ $permissions = $this->ocmPermissions2ncPermissions($ocmPermissions, $path);
+ } elseif ($ocPermissions !== null) {
+ return $this->parsePermissions($ocPermissions);
} else {
// use default permission if remote server doesn't provide the share permissions
$permissions = $this->getDefaultPermissions($path);