ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Readable.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Test\Access;
22
23use Closure;
25use ilObject;
26
28{
30 private readonly Closure $references_of;
31 private readonly Incident $incident;
32
33 public function __construct(
34 private readonly ilAccessHandler $access,
35 $references_of = [ilObject::class, '_getAllReferences'],
36 ?Incident $incident = null
37 ) {
38 $this->references_of = Closure::fromCallable($references_of);
39 $this->incident = $incident ?? new Incident();
40 }
41
45 public function references(array $references): bool
46 {
47 return $this->incident->any(fn(int $ref_id): bool => (
48 $this->access->checkAccess('read', '', $ref_id)
49 ), $references);
50 }
51
52 public function objectId(int $obj_id): bool
53 {
54 return $this->references(($this->references_of)($obj_id));
55 }
56}
readonly Incident $incident
Definition: Readable.php:31
references(array $references)
Definition: Readable.php:45
__construct(private readonly ilAccessHandler $access, $references_of=[ilObject::class, '_getAllReferences'], ?Incident $incident=null)
Definition: Readable.php:33
readonly Closure $references_of
Definition: Readable.php:30
Class ilObject Basic functions for all objects.
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
$ref_id
Definition: ltiauth.php:66