| @@ 258-272 (lines=15) @@ | ||
| 255 | * |
|
| 256 | * @return Result |
|
| 257 | */ |
|
| 258 | public function acceptShare($id) { |
|
| 259 | try { |
|
| 260 | $this->ocmMiddleware->assertOutgoingSharingEnabled(); |
|
| 261 | $token = $this->request->getParam('token', null); |
|
| 262 | $share = $this->ocmMiddleware->getValidShare($id, $token); |
|
| 263 | $this->fedShareManager->acceptShare($share); |
|
| 264 | } catch (NotImplementedException $e) { |
|
| 265 | return new Result( |
|
| 266 | null, |
|
| 267 | Http::STATUS_SERVICE_UNAVAILABLE, |
|
| 268 | 'Server does not support federated cloud sharing' |
|
| 269 | ); |
|
| 270 | } |
|
| 271 | return new Result(); |
|
| 272 | } |
|
| 273 | ||
| 274 | /** |
|
| 275 | * @NoCSRFRequired |
|
| @@ 284-299 (lines=16) @@ | ||
| 281 | * |
|
| 282 | * @return Result |
|
| 283 | */ |
|
| 284 | public function declineShare($id) { |
|
| 285 | try { |
|
| 286 | $token = $this->request->getParam('token', null); |
|
| 287 | $this->ocmMiddleware->assertOutgoingSharingEnabled(); |
|
| 288 | $share = $this->ocmMiddleware->getValidShare($id, $token); |
|
| 289 | $this->fedShareManager->declineShare($share); |
|
| 290 | } catch (NotImplementedException $e) { |
|
| 291 | return new Result( |
|
| 292 | null, |
|
| 293 | Http::STATUS_SERVICE_UNAVAILABLE, |
|
| 294 | 'Server does not support federated cloud sharing' |
|
| 295 | ); |
|
| 296 | } |
|
| 297 | ||
| 298 | return new Result(); |
|
| 299 | } |
|
| 300 | ||
| 301 | /** |
|
| 302 | * @NoCSRFRequired |
|
| @@ 311-328 (lines=18) @@ | ||
| 308 | * |
|
| 309 | * @return Result |
|
| 310 | */ |
|
| 311 | public function unshare($id) { |
|
| 312 | try { |
|
| 313 | $this->ocmMiddleware->assertOutgoingSharingEnabled(); |
|
| 314 | $token = $this->request->getParam('token', null); |
|
| 315 | if ($token && $id) { |
|
| 316 | $this->fedShareManager->unshare($id, $token); |
|
| 317 | } |
|
| 318 | } catch (NotImplementedException $e) { |
|
| 319 | return new Result( |
|
| 320 | null, |
|
| 321 | Http::STATUS_SERVICE_UNAVAILABLE, |
|
| 322 | 'Server does not support federated cloud sharing' |
|
| 323 | ); |
|
| 324 | } catch (\Exception $e) { |
|
| 325 | // pass |
|
| 326 | } |
|
| 327 | return new Result(); |
|
| 328 | } |
|
| 329 | ||
| 330 | /** |
|
| 331 | * @NoCSRFRequired |
|
| @@ 340-350 (lines=11) @@ | ||
| 337 | * |
|
| 338 | * @return Result |
|
| 339 | */ |
|
| 340 | public function revoke($id) { |
|
| 341 | try { |
|
| 342 | $token = $this->request->getParam('token', null); |
|
| 343 | $share = $this->getValidShare($id, $token); |
|
| 344 | $this->fedShareManager->revoke($share); |
|
| 345 | } catch (\Exception $e) { |
|
| 346 | return new Result(null, Http::STATUS_BAD_REQUEST); |
|
| 347 | } |
|
| 348 | ||
| 349 | return new Result(); |
|
| 350 | } |
|
| 351 | ||
| 352 | /** |
|
| 353 | * @NoCSRFRequired |
|