ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.DashboardAccess.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2021 ILIAS open source, Extended GPL, see docs/LICENSE */
4
6
13{
17 protected $rbac_system;
18
22 protected $db;
23
27 protected static $setting_ref_id = 0;
28
32 public function __construct()
33 {
34 global $DIC;
35
36 $this->db = $DIC->database();
37 $this->rbac_system = $DIC->rbac()->system();
38 }
39
43 protected function getSettingsRefId(): int
44 {
45 if (self::$setting_ref_id == 0) {
46 $set = $this->db->queryF(
47 'SELECT object_reference.ref_id FROM object_reference, tree, object_data
48 WHERE tree.parent = %s
49 AND object_data.type = %s
50 AND object_reference.ref_id = tree.child
51 AND object_reference.obj_id = object_data.obj_id',
52 array('integer', 'text'),
53 array(SYSTEM_FOLDER_ID, 'dshs')
54 );
55 $rec = $this->db->fetchAssoc($set);
56 self::$setting_ref_id = (int) $rec["ref_id"];
57 }
59 }
60
64 public function canChangePresentation(int $user_id): bool {
65 return $this->rbac_system->checkAccessOfUser($user_id, "change_presentation", $this->getSettingsRefId());
66 }
67}
An exception for terminatinating execution or to throw for unit testing.
getSettingsRefId()
Get dashboard settings ref id.
$DIC
Definition: xapitoken.php:46