Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(files_sharing): Parse OCM share permissions from OCM and not OCS prop #48366

Merged
merged 3 commits into from
Sep 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -345,14 +345,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
Loading