implement RESHARE_UNDO notification

Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
This commit is contained in:
Bjoern Schiessle 2018-06-05 17:21:51 +02:00
parent d77eedd23b
commit 2bb1956c1f
No known key found for this signature in database
GPG Key ID: 2378A753E2BF04F6
3 changed files with 18 additions and 5 deletions

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

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;

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!");
}