Skip to content

Commit

Permalink
Merge pull request #48401 from nextcloud/backport/48366/stable30
Browse files Browse the repository at this point in the history
  • Loading branch information
provokateurin authored Sep 26, 2024
2 parents dea14e3 + 35d2da4 commit 0676a52
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions apps/files_sharing/lib/External/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,14 +357,21 @@ public function isSharable($path): bool {

public function getPermissions($path): int {
$response = $this->propfind($path);
if ($response === false) {
return 0;
}

$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-collaboration-services.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);
Expand Down

0 comments on commit 0676a52

Please sign in to comment.