implement RESHARE_UNDO notification

Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
pull/9345/head
Bjoern Schiessle 7 years ago
parent d77eedd23b
commit 2bb1956c1f
No known key found for this signature in database
GPG Key ID: 2378A753E2BF04F6
  1. 2
      apps/federatedfilesharing/lib/Controller/RequestHandlerController.php
  2. 18
      apps/federatedfilesharing/lib/Notifications.php
  3. 3
      apps/federatedfilesharing/lib/ocm/CloudFederationProviderFiles.php

@ -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();

@ -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;

@ -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