Skip to content

Commit

Permalink
feat(FederatedFileSharing): Allow CloudFederationProviderFiles to acc…
Browse files Browse the repository at this point in the history
…ept OCM 1.1.0 shares

Signed-off-by: Micke Nordin <[email protected]>
  • Loading branch information
mickenordin committed Aug 16, 2024
1 parent 882ac47 commit 5fdcb79
Showing 1 changed file with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,27 @@ public function shareReceived(ICloudFederationShare $share) {
}

$protocol = $share->getProtocol();
if ($protocol['name'] !== 'webdav') {
$name = '';
if (array_key_exists('name', $protocol)) {
// OCM 1.0.0 https://cs3org.github.io/OCM-API/docs.html?branch=v1.0.0&repo=OCM-API&user=cs3org#/paths/~1shares/post
$name = $protocol['name'];
} else {
// OCM 1.1.0 https://cs3org.github.io/OCM-API/docs.html?branch=v1.1.0&repo=OCM-API&user=cs3org#/paths/~1shares/post
if (array_key_exists('singleProtocolLegacy', $protocol)) {
$name = $protocol['singleProtocolLegacy']['name'];
}
elseif (array_key_exists('singleProtocolLegacy', $protocol)) {
$name = $protocol['singleProtocolNew']['name'];
}
elseif (array_key_exists('multipleProtocols', $protocol)) {
if(array_key_exists('webdav', $protocol['multipleProtocols'])) {
$name = 'webdav';
}
}
}


if ($name !== 'webdav') {
throw new ProviderCouldNotAddShareException('Unsupported protocol for data exchange.', '', Http::STATUS_NOT_IMPLEMENTED);
}

Expand Down Expand Up @@ -212,6 +232,7 @@ public function notificationReceived($notificationType, $providerId, array $noti
return $this->undoReshare($providerId, $notification);
case 'RESHARE_CHANGE_PERMISSION':
return $this->updateResharePermissions($providerId, $notification);
// TODO: Implement USER_REMOVED
}


Expand Down

0 comments on commit 5fdcb79

Please sign in to comment.