Skip to content

Commit 5c38acb

Browse files
committed
fix(ocm): normalize protocol to support multi with webdav option
- Added functionality to handle both plain webdav and multi protocols containing a webdav entry with a sharedSecret. - Fix a bug where owner could empty because it was set ownerDisplayName Signed-off-by: Micke Nordin <kano@sunet.se>
1 parent c316ed6 commit 5c38acb

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

apps/cloud_federation_api/lib/Controller/RequestHandlerController.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,18 @@ public function __construct(
106106
#[NoCSRFRequired]
107107
#[BruteForceProtection(action: 'receiveFederatedShare')]
108108
public function addShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, $protocol, $shareType, $resourceType) {
109+
if ($protocol['name'] === 'multi') {
110+
if (isset($protocol['webdav'])) {
111+
$webdav = $protocol['webdav'];
112+
$protocol = [
113+
'name' => 'webdav',
114+
'options' => [
115+
'sharedSecret' => $webdav['sharedSecret'],
116+
'permissions' => '{http://open-cloud-mesh.org/ns}share-permissions',
117+
],
118+
];
119+
}
120+
}
109121
try {
110122
// if request is signed and well signed, no exception are thrown
111123
// if request is not signed and host is known for not supporting signed request, no exception are thrown

apps/federatedfilesharing/lib/OCM/CloudFederationProviderFiles.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public function shareReceived(ICloudFederationShare $share) {
108108

109109
$token = $share->getShareSecret();
110110
$name = $share->getResourceName();
111-
$owner = $share->getOwnerDisplayName();
111+
$owner = $share->getOwner();
112112
$sharedBy = $share->getSharedByDisplayName();
113113
$shareWith = $share->getShareWith();
114114
$remoteId = $share->getProviderId();

0 commit comments

Comments
 (0)