ILIAS  trunk Revision v11.0_alpha-1843-g9e1fad99175
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\Export\ExportHandler\StaticUrlHandler Class Reference
+ Collaboration diagram for ILIAS\Export\ExportHandler\StaticUrlHandler:

Public Member Functions

 __construct ()
 
 getNamespace ()
 
 handle (Request $request, Context $context, Factory $response_factory)
 

Data Fields

const NAMESPACE = "export"
 
const DOWNLOAD = 'download'
 

Protected Attributes

ilExportHandler $export_handler
 

Detailed Description

Definition at line 30 of file StaticUrlHandler.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Export\ExportHandler\StaticUrlHandler::__construct ( )

Definition at line 38 of file StaticUrlHandler.php.

39  {
40  $this->export_handler = new ilExportHandler();
41  }

Member Function Documentation

◆ getNamespace()

ILIAS\Export\ExportHandler\StaticUrlHandler::getNamespace ( )

Definition at line 43 of file StaticUrlHandler.php.

43  : string
44  {
45  return self::NAMESPACE;
46  }

◆ handle()

ILIAS\Export\ExportHandler\StaticUrlHandler::handle ( Request  $request,
Context  $context,
Factory  $response_factory 
)

Definition at line 48 of file StaticUrlHandler.php.

References $ref_id, ANONYMOUS_USER_ID, ILIAS\StaticURL\Context\checkPermission(), ILIAS\StaticURL\Context\ctrl(), ILIAS\StaticURL\Request\Request\getAdditionalParameters(), ILIAS\StaticURL\Request\Request\getReferenceId(), ILIAS\StaticURL\Context\getUserId(), ILIAS\StaticURL\Context\isPublicSectionActive(), ILIAS\StaticURL\Context\isUserLoggedIn(), and null.

48  : Response
49  {
50  $ref_id = $request->getReferenceId();
51  if (is_null($request->getReferenceId())) {
52  return $response_factory->can($context->ctrl()->getLinkTargetByClass(ilDashboardGUI::class));
53  }
54  $operation = $request->getAdditionalParameters()[0] ?? "";
55  $object_id = $ref_id->toObjectId();
56  $access_granted = false;
57  $pa_possible = false;
58  $key = $this->export_handler->publicAccess()->repository()->key()->handler()->withObjectId($object_id);
59  $element = $this->export_handler->publicAccess()->repository()->handler()->getElement($key);
60  $export_option = is_null($element)
61  ? null
62  : $this->export_handler->consumer()->exportOption()->exportOptionWithId($element->getValues()->getExportOptionId());
63  if ($context->isUserLoggedIn() and $context->checkPermission("read", $ref_id->toInt())) {
64  $access_granted = true;
65  }
66  if (
67  $context->getUserId() === ANONYMOUS_USER_ID and
68  $context->isPublicSectionActive() and
69  $context->checkPermission('read', $ref_id->toInt())
70  ) {
71  $access_granted = true;
72  }
73  if (
74  is_null($element) or
75  is_null($export_option) or
76  !$export_option->isPublicAccessPossible() or
77  !$access_granted or
78  $operation !== self::DOWNLOAD
79  ) {
80  return $response_factory->can($context->ctrl()->getLinkTargetByClass(ilDashboardGUI::class));
81  }
82  $export_option->onDownloadWithLink(
83  $ref_id,
84  $this->export_handler->consumer()->file()->identifier()->handler()->withIdentifier($element->getValues()->getIdentification())
85  );
86  return $response_factory->cannot();
87  }
$context
Definition: webdav.php:31
const ANONYMOUS_USER_ID
Definition: constants.php:27
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$ref_id
Definition: ltiauth.php:65
+ Here is the call graph for this function:

Field Documentation

◆ $export_handler

ilExportHandler ILIAS\Export\ExportHandler\StaticUrlHandler::$export_handler
protected

Definition at line 35 of file StaticUrlHandler.php.

◆ DOWNLOAD

const ILIAS\Export\ExportHandler\StaticUrlHandler::DOWNLOAD = 'download'

Definition at line 33 of file StaticUrlHandler.php.

◆ NAMESPACE

const ILIAS\Export\ExportHandler\StaticUrlHandler::NAMESPACE = "export"

Definition at line 32 of file StaticUrlHandler.php.


The documentation for this class was generated from the following file: