|
@@ 288-309 (lines=22) @@
|
| 285 |
|
* |
| 286 |
|
* @return Result |
| 287 |
|
*/ |
| 288 |
|
public function acceptShare($id) { |
| 289 |
|
if (!$this->isS2SEnabled()) { |
| 290 |
|
return new Result(null, 503, 'Server does not support federated cloud sharing'); |
| 291 |
|
} |
| 292 |
|
|
| 293 |
|
$token = isset($_POST['token']) ? $_POST['token'] : null; |
| 294 |
|
|
| 295 |
|
try { |
| 296 |
|
$share = $this->federatedShareProvider->getShareById($id); |
| 297 |
|
if ($this->verifyShare($share, $token)) { |
| 298 |
|
$this->fedShareManager->acceptShare($share); |
| 299 |
|
if ($share->getShareOwner() !== $share->getSharedBy()) { |
| 300 |
|
list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedBy()); |
| 301 |
|
$remoteId = $this->federatedShareProvider->getRemoteId($share); |
| 302 |
|
$this->notifications->sendAcceptShare($remote, $remoteId, $share->getToken()); |
| 303 |
|
} |
| 304 |
|
} |
| 305 |
|
} catch (Share\Exceptions\ShareNotFound $e) { |
| 306 |
|
// pass |
| 307 |
|
} |
| 308 |
|
return new Result(); |
| 309 |
|
} |
| 310 |
|
|
| 311 |
|
/** |
| 312 |
|
* @NoCSRFRequired |
|
@@ 321-343 (lines=23) @@
|
| 318 |
|
* |
| 319 |
|
* @return Result |
| 320 |
|
*/ |
| 321 |
|
public function declineShare($id) { |
| 322 |
|
if (!$this->isS2SEnabled()) { |
| 323 |
|
return new Result(null, 503, 'Server does not support federated cloud sharing'); |
| 324 |
|
} |
| 325 |
|
|
| 326 |
|
$token = isset($_POST['token']) ? $_POST['token'] : null; |
| 327 |
|
|
| 328 |
|
try { |
| 329 |
|
$share = $this->federatedShareProvider->getShareById($id); |
| 330 |
|
if ($this->verifyShare($share, $token)) { |
| 331 |
|
if ($share->getShareOwner() !== $share->getSharedBy()) { |
| 332 |
|
list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedBy()); |
| 333 |
|
$remoteId = $this->federatedShareProvider->getRemoteId($share); |
| 334 |
|
$this->notifications->sendDeclineShare($remote, $remoteId, $share->getToken()); |
| 335 |
|
} |
| 336 |
|
$this->fedShareManager->declineShare($share); |
| 337 |
|
} |
| 338 |
|
} catch (Share\Exceptions\ShareNotFound $e) { |
| 339 |
|
// pass |
| 340 |
|
} |
| 341 |
|
|
| 342 |
|
return new Result(); |
| 343 |
|
} |
| 344 |
|
|
| 345 |
|
/** |
| 346 |
|
* @NoCSRFRequired |