ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 ( )

◆ handle()

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

Definition at line 48 of file StaticUrlHandler.php.

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 }
const ANONYMOUS_USER_ID
Definition: constants.php:27
$ref_id
Definition: ltiauth.php:66
$context
Definition: webdav.php:31

References $context, $ref_id, ANONYMOUS_USER_ID, ILIAS\StaticURL\Request\Request\getAdditionalParameters(), and ILIAS\StaticURL\Request\Request\getReferenceId().

+ 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"

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