ILIAS
trunk Revision v11.0_alpha-2662-g519ff7d528f
◀ ilDoc Overview
AccessQuestionImage.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\Test\Access
;
22
23
use
ILIAS\Data\Result
;
24
use
ILIAS\Data\Result\Ok
;
25
use
ILIAS\Data\Result\Error
;
26
27
class
AccessQuestionImage
implements
SimpleAccess
28
{
29
public
function
__construct
(
private
readonly
Readable
$readable)
30
{
31
}
32
33
public
function
isPermitted
(
string
$path
):
Result
34
{
35
$object_id = $this->
objectId
($path);
36
if
(!$object_id) {
37
return
new
Error
(
'Not a question image path of test questions.'
);
38
}
39
40
return
new
Ok
($this->readable->objectId($object_id));
41
}
42
43
private
function
objectId
(
string
$path
): ?
int
44
{
45
$results
= [];
46
if
(!preg_match(
':/assessment/(\d+)/(\d+)/images/([^/]+)$:'
, $path,
$results
)) {
47
return
null
;
48
}
49
50
return
(
int
)
$results
[1];
51
}
52
}
ILIAS\Test\Access
Definition:
AccessFileUploadAnswer.php:21
ILIAS\Data\Result
Definition:
Error.php:21
ILIAS\Test\Access\AccessQuestionImage
Definition:
AccessQuestionImage.php:27
ILIAS\Test\Access\SimpleAccess
Definition:
SimpleAccess.php:25
ILIAS\MetaData\OERExposer\OAIPMH\Responses\Error
Error
Definition:
Error.php:23
ILIAS\Test\Access\AccessQuestionImage\objectId
objectId(string $path)
Definition:
AccessQuestionImage.php:43
$path
$path
Definition:
ltiservices.php:29
ILIAS\Test\Access\AccessQuestionImage\isPermitted
isPermitted(string $path)
Definition:
AccessQuestionImage.php:33
null
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
Definition:
shib_logout.php:144
ILIAS\Data\Result\Ok
A result encapsulates a value or an error and simplifies the handling of those.
Definition:
Ok.php:30
$results
$results
Definition:
save_question_post_data.php:22
ILIAS\Test\Access\Readable
Definition:
Readable.php:27
ILIAS\Test\Access\AccessQuestionImage\__construct
__construct(private readonly Readable $readable)
Definition:
AccessQuestionImage.php:29
Ok
WrapperInterface
ILIAS\Repository\int
int(string $key)
Definition:
trait.BaseGUIRequest.php:61
components
ILIAS
Test
src
Access
AccessQuestionImage.php
Generated on Wed Sep 3 2025 23:04:03 for ILIAS by
1.8.13 (using
Doxyfile
)