ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilWACSignedResourceStorage.php
Go to the documentation of this file.
1<?php
2
23
29{
33
34 public function __construct()
35 {
36 global $DIC;
37 $this->stream_access = $DIC[InitResourceStorage::D_STREAM_ACCESS];
38 $this->storage_handlers = $DIC[InitResourceStorage::D_STORAGE_HANDLERS];
39 $this->manager = $DIC->resourceStorage()->manage();
40 }
41
42 public function canBeDelivered(ilWACPath $ilWACPath): bool
43 {
44 $token = $ilWACPath->getAppendix();
45 $token = $this->stream_access->getTokenFactory()->check($token);
46 $rid = $this->resolveRidFromStreamURI($token->resolveStream()->getMetadata('uri') ?? '');
47 if ($rid === null) {
48 return false;
49 }
50
51 $resource = $this->manager->getResource($rid);
52 foreach ($resource->getStakeholders() as $stakeholder) {
53 if ($stakeholder->canBeAccessedByCurrentUser($rid)) {
54 return true;
55 }
56 }
57
58 return false;
59 }
60
61 private function resolveRidFromStreamURI(string $uri): ?ResourceIdentification
62 {
63 return $this->storage_handlers->getRidForURI($uri);
64 }
65}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilWACSignedResourceStorage.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: shib_login.php:26
$token
Definition: xapitoken.php:70