|
@@ 368-403 (lines=36) @@
|
| 365 |
|
* @throws BadRequestException |
| 366 |
|
* @throws \OC\HintException |
| 367 |
|
*/ |
| 368 |
|
private function shareAccepted($id, array $notification) { |
| 369 |
|
|
| 370 |
|
if (!$this->isS2SEnabled()) { |
| 371 |
|
throw new ActionNotSupportedException('Server does not support federated cloud sharing'); |
| 372 |
|
} |
| 373 |
|
|
| 374 |
|
if (!isset($notification['sharedSecret'])) { |
| 375 |
|
throw new BadRequestException(['sharedSecret']); |
| 376 |
|
} |
| 377 |
|
|
| 378 |
|
$token = $notification['sharedSecret']; |
| 379 |
|
|
| 380 |
|
$share = $this->federatedShareProvider->getShareById($id); |
| 381 |
|
|
| 382 |
|
$this->verifyShare($share, $token); |
| 383 |
|
$this->executeAcceptShare($share); |
| 384 |
|
if ($share->getShareOwner() !== $share->getSharedBy()) { |
| 385 |
|
list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedBy()); |
| 386 |
|
$remoteId = $this->federatedShareProvider->getRemoteId($share); |
| 387 |
|
$notification = $this->cloudFederationFactory->getCloudFederationNotification(); |
| 388 |
|
$notification->setMessage( |
| 389 |
|
'SHARE_ACCEPTED', |
| 390 |
|
'file', |
| 391 |
|
$remoteId, |
| 392 |
|
[ |
| 393 |
|
'sharedSecret' => $token, |
| 394 |
|
'message' => 'Recipient accepted the re-share' |
| 395 |
|
] |
| 396 |
|
|
| 397 |
|
); |
| 398 |
|
$this->cloudFederationProviderManager->sendNotification($remote, $notification); |
| 399 |
|
|
| 400 |
|
} |
| 401 |
|
|
| 402 |
|
return []; |
| 403 |
|
} |
| 404 |
|
|
| 405 |
|
/** |
| 406 |
|
* @param IShare $share |
|
@@ 440-477 (lines=38) @@
|
| 437 |
|
* @throws \OC\HintException |
| 438 |
|
* |
| 439 |
|
*/ |
| 440 |
|
protected function shareDeclined($id, array $notification) { |
| 441 |
|
|
| 442 |
|
if (!$this->isS2SEnabled()) { |
| 443 |
|
throw new ActionNotSupportedException('Server does not support federated cloud sharing'); |
| 444 |
|
} |
| 445 |
|
|
| 446 |
|
if (!isset($notification['sharedSecret'])) { |
| 447 |
|
throw new BadRequestException(['sharedSecret']); |
| 448 |
|
} |
| 449 |
|
|
| 450 |
|
$token = $notification['sharedSecret']; |
| 451 |
|
|
| 452 |
|
$share = $this->federatedShareProvider->getShareById($id); |
| 453 |
|
|
| 454 |
|
$this->verifyShare($share, $token); |
| 455 |
|
|
| 456 |
|
if ($share->getShareOwner() !== $share->getSharedBy()) { |
| 457 |
|
list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedBy()); |
| 458 |
|
$remoteId = $this->federatedShareProvider->getRemoteId($share); |
| 459 |
|
$notification = $this->cloudFederationFactory->getCloudFederationNotification(); |
| 460 |
|
$notification->setMessage( |
| 461 |
|
'SHARE_DECLINED', |
| 462 |
|
'file', |
| 463 |
|
$remoteId, |
| 464 |
|
[ |
| 465 |
|
'sharedSecret' => $token, |
| 466 |
|
'message' => 'Recipient declined the re-share' |
| 467 |
|
] |
| 468 |
|
|
| 469 |
|
); |
| 470 |
|
$this->cloudFederationProviderManager->sendNotification($remote, $notification); |
| 471 |
|
} |
| 472 |
|
|
| 473 |
|
$this->executeDeclineShare($share); |
| 474 |
|
|
| 475 |
|
return []; |
| 476 |
|
|
| 477 |
|
} |
| 478 |
|
|
| 479 |
|
/** |
| 480 |
|
* delete declined share and create a activity |