|
@@ 311-346 (lines=36) @@
|
| 308 |
|
* @throws BadRequestException |
| 309 |
|
* @throws \OC\HintException |
| 310 |
|
*/ |
| 311 |
|
private function shareAccepted($id, array $notification) { |
| 312 |
|
|
| 313 |
|
if (!$this->isS2SEnabled()) { |
| 314 |
|
throw new ActionNotSupportedException('Server does not support federated cloud sharing'); |
| 315 |
|
} |
| 316 |
|
|
| 317 |
|
if (!isset($notification['sharedSecret'])) { |
| 318 |
|
throw new BadRequestException(['sharedSecret']); |
| 319 |
|
} |
| 320 |
|
|
| 321 |
|
$token = $notification['sharedSecret']; |
| 322 |
|
|
| 323 |
|
$share = $this->federatedShareProvider->getShareById($id); |
| 324 |
|
|
| 325 |
|
$this->verifyShare($share, $token); |
| 326 |
|
$this->executeAcceptShare($share); |
| 327 |
|
if ($share->getShareOwner() !== $share->getSharedBy()) { |
| 328 |
|
list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedBy()); |
| 329 |
|
$remoteId = $this->federatedShareProvider->getRemoteId($share); |
| 330 |
|
$notification = $this->cloudFederationFactory->getCloudFederationNotification(); |
| 331 |
|
$notification->setMessage( |
| 332 |
|
'SHARE_ACCEPTED', |
| 333 |
|
'file', |
| 334 |
|
$remoteId, |
| 335 |
|
[ |
| 336 |
|
'sharedSecret' => $token, |
| 337 |
|
'message' => 'Recipient accepted the re-share' |
| 338 |
|
] |
| 339 |
|
|
| 340 |
|
); |
| 341 |
|
$this->cloudFederationProviderManager->sendNotification($remote, $notification); |
| 342 |
|
|
| 343 |
|
} |
| 344 |
|
|
| 345 |
|
return []; |
| 346 |
|
} |
| 347 |
|
|
| 348 |
|
/** |
| 349 |
|
* @param IShare $share |
|
@@ 383-420 (lines=38) @@
|
| 380 |
|
* @throws \OC\HintException |
| 381 |
|
* |
| 382 |
|
*/ |
| 383 |
|
protected function shareDeclined($id, array $notification) { |
| 384 |
|
|
| 385 |
|
if (!$this->isS2SEnabled()) { |
| 386 |
|
throw new ActionNotSupportedException('Server does not support federated cloud sharing'); |
| 387 |
|
} |
| 388 |
|
|
| 389 |
|
if (!isset($notification['sharedSecret'])) { |
| 390 |
|
throw new BadRequestException(['sharedSecret']); |
| 391 |
|
} |
| 392 |
|
|
| 393 |
|
$token = $notification['sharedSecret']; |
| 394 |
|
|
| 395 |
|
$share = $this->federatedShareProvider->getShareById($id); |
| 396 |
|
|
| 397 |
|
$this->verifyShare($share, $token); |
| 398 |
|
|
| 399 |
|
if ($share->getShareOwner() !== $share->getSharedBy()) { |
| 400 |
|
list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedBy()); |
| 401 |
|
$remoteId = $this->federatedShareProvider->getRemoteId($share); |
| 402 |
|
$notification = $this->cloudFederationFactory->getCloudFederationNotification(); |
| 403 |
|
$notification->setMessage( |
| 404 |
|
'SHARE_DECLINED', |
| 405 |
|
'file', |
| 406 |
|
$remoteId, |
| 407 |
|
[ |
| 408 |
|
'sharedSecret' => $token, |
| 409 |
|
'message' => 'Recipient declined the re-share' |
| 410 |
|
] |
| 411 |
|
|
| 412 |
|
); |
| 413 |
|
$this->cloudFederationProviderManager->sendNotification($remote, $notification); |
| 414 |
|
} |
| 415 |
|
|
| 416 |
|
$this->executeDeclineShare($share); |
| 417 |
|
|
| 418 |
|
return []; |
| 419 |
|
|
| 420 |
|
} |
| 421 |
|
|
| 422 |
|
/** |
| 423 |
|
* delete declined share and create a activity |