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