diff options
author | Bjoern Schiessle <bjoern@schiessle.org> | 2018-06-05 17:21:51 +0200 |
---|---|---|
committer | Bjoern Schiessle <bjoern@schiessle.org> | 2018-07-02 11:29:29 +0200 |
commit | 2bb1956c1f69ea7159e65d49ed0cc2a127749be6 (patch) | |
tree | 006ab3a194a1a8df9e3aa1a2e9aa8543d1f96760 /apps | |
parent | d77eedd23bac7f9d28a5d478263914c34b8003c4 (diff) | |
download | nextcloud-server-2bb1956c1f69ea7159e65d49ed0cc2a127749be6.tar.gz nextcloud-server-2bb1956c1f69ea7159e65d49ed0cc2a127749be6.zip |
implement RESHARE_UNDO notification
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'apps')
3 files changed, 18 insertions, 5 deletions
diff --git a/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php b/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php index 0b490b57575..30330accddf 100644 --- a/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php +++ b/apps/federatedfilesharing/lib/Controller/RequestHandlerController.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(); diff --git a/apps/federatedfilesharing/lib/Notifications.php b/apps/federatedfilesharing/lib/Notifications.php index 36eb88e31a2..e15e9c2f6ab 100644 --- a/apps/federatedfilesharing/lib/Notifications.php +++ b/apps/federatedfilesharing/lib/Notifications.php @@ -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; diff --git a/apps/federatedfilesharing/lib/ocm/CloudFederationProviderFiles.php b/apps/federatedfilesharing/lib/ocm/CloudFederationProviderFiles.php index dc022e4f9c8..cc14d35a3d0 100644 --- a/apps/federatedfilesharing/lib/ocm/CloudFederationProviderFiles.php +++ b/apps/federatedfilesharing/lib/ocm/CloudFederationProviderFiles.php @@ -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!"); } |