ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilContainerReferenceAccess.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25{
29 public static function _isAccessible(int $a_ref_id): bool
30 {
31 global $DIC;
32
33 $ilDB = $DIC->database();
34 $tree = $DIC->repositoryTree();
35 $access = $DIC->access();
36
37 $obj_id = ilObject::_lookupObjId($a_ref_id);
38 $query = "SELECT target_obj_id FROM container_reference " .
39 "WHERE obj_id = " . $ilDB->quote($obj_id, 'integer') . " ";
40 $res = $ilDB->query($query);
41 $target_id = 0;
42 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
43 $target_id = (int) $row->target_obj_id;
44 }
45 $target_ref_ids = ilObject::_getAllReferences($target_id);
46 $target_ref_id = current($target_ref_ids);
47 return
48 !$tree->isDeleted($target_ref_id) &&
49 $access->checkAccess('read', '', $target_ref_id);
50 }
51}
static _isAccessible(int $a_ref_id)
Check if target is accessible and not deleted.
Class ilObjectAccess.
static _getAllReferences(int $id)
get all reference ids for object ID
static _lookupObjId(int $ref_id)
$res
Definition: ltiservices.php:69
global $DIC
Definition: shib_login.php:26