ILIAS
release_10 Revision v10.1-43-ga1241a92c2f
◀ ilDoc Overview
StaticUrlHandler.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\Export\ExportHandler
;
22
23
use
ilDashboardGUI
;
24
use
ILIAS\Export\ExportHandler\Factory
as ilExportHandler;
25
use
ILIAS\StaticURL\Context
;
26
use
ILIAS\StaticURL\Request\Request
;
27
use
ILIAS\StaticURL\Response\Factory
;
28
use
ILIAS\StaticURL\Response\Response
;
29
30
class
StaticUrlHandler
31
{
32
public
const
NAMESPACE
=
"export"
;
33
public
const
DOWNLOAD
=
'download'
;
34
35
protected
ilExportHandler
$export_handler
;
36
37
38
public
function
__construct
()
39
{
40
$this->export_handler =
new
ilExportHandler();
41
}
42
43
public
function
getNamespace
(): string
44
{
45
return
self::NAMESPACE;
46
}
47
48
public
function
handle
(
Request
$request,
Context
$context
,
Factory
$response_factory):
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
}
88
}
ILIAS\Export\ExportHandler\StaticUrlHandler\getNamespace
getNamespace()
Definition:
StaticUrlHandler.php:43
ILIAS\StaticURL\Context\getUserId
getUserId()
Definition:
Context.php:79
ILIAS\StaticURL\Request\Request\getAdditionalParameters
getAdditionalParameters()
Definition:
Request.php:47
ILIAS\StaticURL\Context\checkPermission
checkPermission(string $permission, int $ref_id)
Definition:
Context.php:64
$context
$context
Definition:
webdav.php:31
ANONYMOUS_USER_ID
const ANONYMOUS_USER_ID
Definition:
constants.php:27
ILIAS\Export\ExportHandler\StaticUrlHandler\$export_handler
ilExportHandler $export_handler
Definition:
StaticUrlHandler.php:35
ILIAS\Export\ExportHandler\StaticUrlHandler\handle
handle(Request $request, Context $context, Factory $response_factory)
Definition:
StaticUrlHandler.php:48
ILIAS\StaticURL\Context\ctrl
ctrl()
Definition:
Context.php:59
ILIAS\StaticURL\Context
Definition:
Context.php:28
ilDashboardGUI
ILIAS\StaticURL\Request\Request\getReferenceId
getReferenceId()
Definition:
Request.php:42
Factory
Request
ILIAS\Export\ExportHandler
ILIAS\Export\ExportHandler\StaticUrlHandler\__construct
__construct()
Definition:
StaticUrlHandler.php:38
ServerRequestInterface
ILIAS\StaticURL\Context\isUserLoggedIn
isUserLoggedIn()
Definition:
Context.php:84
ILIAS\Export\ExportHandler\Factory
Definition:
Factory.php:57
$ref_id
$ref_id
Definition:
ltiauth.php:66
Response
ILIAS\Export\ExportHandler\StaticUrlHandler
Definition:
StaticUrlHandler.php:30
ILIAS\Export\ExportHandler\StaticUrlHandler\DOWNLOAD
const DOWNLOAD
Definition:
StaticUrlHandler.php:33
ILIAS\Export\ExportHandler\StaticUrlHandler\NAMESPACE
const NAMESPACE
Definition:
StaticUrlHandler.php:32
Context
ILIAS\StaticURL\Response\Response
Definition:
Response.php:24
ILIAS\StaticURL\Context\isPublicSectionActive
isPublicSectionActive()
Definition:
Context.php:89
components
ILIAS
Export
classes
ExportHandler
StaticUrlHandler.php
Generated on Wed Sep 10 2025 15:14:52 for ILIAS by
1.8.13 (using
Doxyfile
)