19 declare(strict_types=1);
57 $type_of = [ilObject::class,
'_lookupType']
63 $this->type_of = Closure::fromCallable(
$type_of);
70 return new Error(
'Not a question image path of test questions.');
73 $object_id = $this->
objectId($question_id);
78 $permitted = $this->incident->any([$this,
'refIdPermitted'], ($this->references_of)($object_id));
80 return new Ok($permitted);
88 $ref_id = (int) $ref_id;
92 case 'qpl':
return $this->access->checkAccess(
'read',
'', $ref_id);
93 case 'tst':
return $this->access->checkAccess(
'write',
'', $ref_id);
94 default:
return false;
101 if (!preg_match(
':/assessment/qst_preview/\d+/(\d+)/fileuploads/([^/]+)$:', $path,
$results)) {
110 $object_id = $this->database->fetchAssoc($this->database->queryF(
111 'SELECT obj_fi FROM qpl_questions WHERE question_id = %s',
114 ))[
'obj_fi'] ?? null;
116 return $object_id ? (int) $object_id : null;
isPermitted(string $path)
objectId(int $question_id)
A result encapsulates a value or an error and simplifies the handling of those.
A result encapsulates a value or an error and simplifies the handling of those.
__construct(ilDBInterface $database, ilAccess $access, ?Incident $incident=null, $references_of=[ilObject::class, '_getAllReferences'], $type_of=[ilObject::class, '_lookupType'])
A result encapsulates a value or an error and simplifies the handling of those.