ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilWACSignedResourceStorage.php
Go to the documentation of this file.
1 <?php
2 
23 
29 {
32  private Manager $manager;
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.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$token
Definition: xapitoken.php:70
global $DIC
Definition: shib_login.php:22
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...