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