@@ 250-264 (lines=15) @@ | ||
247 | * |
|
248 | * @return Result |
|
249 | */ |
|
250 | public function acceptShare($id) { |
|
251 | try { |
|
252 | $this->ocmMiddleware->assertOutgoingSharingEnabled(); |
|
253 | $token = $this->request->getParam('token', null); |
|
254 | $share = $this->ocmMiddleware->getValidShare($id, $token); |
|
255 | $this->fedShareManager->acceptShare($share); |
|
256 | } catch (NotImplementedException $e) { |
|
257 | return new Result( |
|
258 | null, |
|
259 | Http::STATUS_SERVICE_UNAVAILABLE, |
|
260 | 'Server does not support federated cloud sharing' |
|
261 | ); |
|
262 | } |
|
263 | return new Result(); |
|
264 | } |
|
265 | ||
266 | /** |
|
267 | * @NoCSRFRequired |
|
@@ 276-291 (lines=16) @@ | ||
273 | * |
|
274 | * @return Result |
|
275 | */ |
|
276 | public function declineShare($id) { |
|
277 | try { |
|
278 | $token = $this->request->getParam('token', null); |
|
279 | $this->ocmMiddleware->assertOutgoingSharingEnabled(); |
|
280 | $share = $this->ocmMiddleware->getValidShare($id, $token); |
|
281 | $this->fedShareManager->declineShare($share); |
|
282 | } catch (NotImplementedException $e) { |
|
283 | return new Result( |
|
284 | null, |
|
285 | Http::STATUS_SERVICE_UNAVAILABLE, |
|
286 | 'Server does not support federated cloud sharing' |
|
287 | ); |
|
288 | } |
|
289 | ||
290 | return new Result(); |
|
291 | } |
|
292 | ||
293 | /** |
|
294 | * @NoCSRFRequired |
|
@@ 303-320 (lines=18) @@ | ||
300 | * |
|
301 | * @return Result |
|
302 | */ |
|
303 | public function unshare($id) { |
|
304 | try { |
|
305 | $this->ocmMiddleware->assertOutgoingSharingEnabled(); |
|
306 | $token = $this->request->getParam('token', null); |
|
307 | if ($token && $id) { |
|
308 | $this->fedShareManager->unshare($id, $token); |
|
309 | } |
|
310 | } catch (NotImplementedException $e) { |
|
311 | return new Result( |
|
312 | null, |
|
313 | Http::STATUS_SERVICE_UNAVAILABLE, |
|
314 | 'Server does not support federated cloud sharing' |
|
315 | ); |
|
316 | } catch (\Exception $e) { |
|
317 | // pass |
|
318 | } |
|
319 | return new Result(); |
|
320 | } |
|
321 | ||
322 | /** |
|
323 | * @NoCSRFRequired |
|
@@ 332-342 (lines=11) @@ | ||
329 | * |
|
330 | * @return Result |
|
331 | */ |
|
332 | public function revoke($id) { |
|
333 | try { |
|
334 | $token = $this->request->getParam('token', null); |
|
335 | $share = $this->ocmMiddleware->getValidShare($id, $token); |
|
336 | $this->fedShareManager->undoReshare($share); |
|
337 | } catch (\Exception $e) { |
|
338 | return new Result(null, Http::STATUS_BAD_REQUEST); |
|
339 | } |
|
340 | ||
341 | return new Result(); |
|
342 | } |
|
343 | ||
344 | /** |
|
345 | * @NoCSRFRequired |