Browse Source

implement RESHARE_UNDO notification

Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
tags/v14.0.0beta1
Bjoern Schiessle 6 years ago
parent
commit
2bb1956c1f
No account linked to committer's email address

+ 1
- 1
apps/federatedfilesharing/lib/Controller/RequestHandlerController.php View File

@@ -370,7 +370,7 @@ class RequestHandlerController extends OCSController {

try {
$provider = $this->cloudFederationProviderManager->getCloudFederationProvider('file');
$provider->notificationReceived('SHARE_UNSHARE', $id, $notification);
$provider->notificationReceived('RESHARE_UNDO', $id, $notification);
return new Http\DataResponse();
} catch (\Exception $e) {
throw new OCSBadRequestException();

+ 16
- 2
apps/federatedfilesharing/lib/Notifications.php View File

@@ -319,8 +319,10 @@ class Notifications {

// if possible we use the new OCM API
$ocmResult = $this->tryOCMEndPoint($remoteDomain, $fields, $action);
if ($ocmResult) {
if (is_array($ocmResult)) {
$result['success'] = true;
$result['result'] = json_encode([
'ocs' => ['meta' => ['statuscode' => 200]]]);
return $result;
}

@@ -440,10 +442,22 @@ class Notifications {
$fields['remoteId'],
[
'sharedSecret' => $fields['token'],
'messgage' => 'file is no longer shared with you'
]
);
return $this->federationProviderManager->sendNotification($remoteDomain, $notification);
case 'reshare_undo':
// if a reshare was unshared we send the information to the initiator/owner
$notification = $this->cloudFederationFactory->getCloudFederationNotification();
$notification->setMessage('RESHARE_UNDO',
'file',
$fields['remoteId'],
[
'sharedSecret' => $fields['token'],
'message' => 'reshare was revoked'
]
);
return $this->federationProviderManager->sendNotification($remoteDomain, $notification);
return false;
}

return false;

+ 1
- 2
apps/federatedfilesharing/lib/ocm/CloudFederationProviderFiles.php View File

@@ -456,7 +456,6 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
* @throws ShareNotFoundException
*/
private function undoReshare($id, $notification) {

if (!isset($notification['sharedSecret'])) {
throw new BadRequestException(['sharedSecret']);
}
@@ -470,7 +469,7 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
}

private function unshare($id, $notification) {
error_log("new unshare!");
if (!$this->isS2SEnabled(true)) {
throw new ActionNotSupportedException("incoming shares disabled!");
}

Loading…
Cancel
Save