19declare(strict_types=1);
53 $type_of = [ilObject::class,
'_lookupType']
59 $this->type_of = Closure::fromCallable(
$type_of);
66 return new Error(
'Not a question image path of test questions.');
69 $object_id = $this->
objectId($question_id);
74 $permitted = $this->incident->any([$this,
'refIdPermitted'], ($this->references_of)($object_id));
76 return new Ok($permitted);
85 case 'qpl':
return $this->
access->checkAccess(
'read',
'', $ref_id);
86 case 'tst':
return $this->
access->checkAccess(
'write',
'', $ref_id);
87 default:
return false;
94 if (!preg_match(
':/assessment/qst_preview/\d+/(\d+)/fileuploads/([^/]+)$:',
$path,
$results)) {
104 'SELECT obj_fi FROM qpl_questions WHERE question_id = %s',
107 ))[
'obj_fi'] ??
null;
109 return $object_id ? (
int) $object_id :
null;
A result encapsulates a value or an error and simplifies the handling of those.
isPermitted(string $path)
__construct(ilDBInterface $database, ilAccessHandler $access, ?Incident $incident=null, $references_of=[ilObject::class, '_getAllReferences'], $type_of=[ilObject::class, '_lookupType'])
refIdPermitted(int $ref_id)
objectId(int $question_id)
Class ilObject Basic functions for all objects.
A result encapsulates a value or an error and simplifies the handling of those.
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...