ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
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)
 

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.

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

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:29
+ 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.

References $results, and null.

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

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  }
$path
Definition: ltiservices.php:29
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$results
+ Here is the caller graph for this function:

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