ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.DashboardAccess.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
25use ilRbacSystem;
26
28{
30 protected ilDBInterface $db;
31 protected static int $setting_ref_id = 0;
32
33 public function __construct()
34 {
35 global $DIC;
36
37 $this->db = $DIC->database();
38 $this->rbac_system = $DIC->rbac()->system();
39 }
40
41 protected function getSettingsRefId(): int
42 {
43 if (self::$setting_ref_id == 0) {
44 $set = $this->db->queryF(
45 'SELECT object_reference.ref_id FROM object_reference, tree, object_data
46 WHERE tree.parent = %s
47 AND object_data.type = %s
48 AND object_reference.ref_id = tree.child
49 AND object_reference.obj_id = object_data.obj_id',
51 [SYSTEM_FOLDER_ID, 'dshs']
52 );
53 $rec = $this->db->fetchAssoc($set);
54 self::$setting_ref_id = (int) $rec['ref_id'];
55 }
57 }
58
59 public function canChangePresentation(int $user_id): bool
60 {
61 return $this->rbac_system->checkAccessOfUser($user_id, 'change_presentation', $this->getSettingsRefId());
62 }
63}
Class ilDBConstants.
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
const SYSTEM_FOLDER_ID
Definition: constants.php:35
Interface ilDBInterface.
global $DIC
Definition: shib_login.php:26