ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Test\Access\AccessQuestionImage Class Reference
+ Inheritance diagram for ILIAS\Test\Access\AccessQuestionImage:
+ Collaboration diagram for ILIAS\Test\Access\AccessQuestionImage:

Public Member Functions

 __construct (private readonly Readable $readable)
 
 isPermitted (string $path)
 
 isPermitted (string $path)
 

Private Member Functions

 objectId (string $path)
 

Detailed Description

Definition at line 27 of file AccessQuestionImage.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Test\Access\AccessQuestionImage::__construct ( private readonly Readable  $readable)

Definition at line 29 of file AccessQuestionImage.php.

30 {
31 }

Member Function Documentation

◆ isPermitted()

ILIAS\Test\Access\AccessQuestionImage::isPermitted ( string  $path)
Returns
Result<bool>

Implements ILIAS\Test\Access\SimpleAccess.

Definition at line 33 of file AccessQuestionImage.php.

33 : 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 }
$path
Definition: ltiservices.php:30

References ILIAS\Test\Access\AccessQuestionImage\objectId().

+ Here is the call graph for this function:

◆ objectId()

ILIAS\Test\Access\AccessQuestionImage::objectId ( string  $path)
private

Definition at line 43 of file AccessQuestionImage.php.

43 : ?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 }
$results

References $path, and $results.

Referenced by ILIAS\Test\Access\AccessQuestionImage\isPermitted().

+ Here is the caller graph for this function:

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