ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjOrgUnitAccess.php
Go to the documentation of this file.
1<?php
2
25{
36 public static function _getCommands(): array
37 {
38 $commands = [
39 [
40 'permission' => 'read',
41 'cmd' => 'view',
42 'lang_var' => 'show',
43 'default' => true,
44 ],
45 ];
46
47 return $commands;
48 }
49
50 public static function _checkAccessStaff(int $ref_id): bool
51 {
52 global $DIC;
53
54 return ($DIC->access()->checkAccess('write', '', $ref_id)
55 || $DIC->access()->checkAccess('view_learning_progress', '', $ref_id))
56 && $DIC->access()->checkAccess('read', '', $ref_id);
57 }
58
59 public static function _checkAccessSettings(int $ref_id): bool
60 {
61 global $DIC;
62
63 return $DIC->access()->checkAccess('write', '', $ref_id);
64 }
65
66 public static function _checkAccessExport(int $ref_id): bool
67 {
68 global $DIC;
69
70 return $DIC->access()->checkAccess('write', '', $ref_id);
71 }
72
73 public static function _checkAccessTypes(int $ref_id): bool
74 {
75 global $DIC;
76
77 return $DIC->access()->checkAccess('write', '', $ref_id);
78 }
79
80 public static function _checkAccessPositions(int $ref_id): bool
81 {
82 global $DIC;
83
84 return $DIC->access()->checkAccess('write', '', $ref_id);
85 }
86
87 public static function _checkAccessStaffRec(int $ref_id): bool
88 {
89 global $DIC;
90
91 return ($DIC->access()->checkAccess('write', '', $ref_id)
92 || $DIC->access()->checkAccess('view_learning_progress_rec', '', $ref_id))
93 && $DIC->access()->checkAccess('read', '', $ref_id);
94 }
95
96 public static function _checkAccessAdministrateUsers(int $ref_id): bool
97 {
98 global $DIC;
99
100 return ilUserAccountSettings::getInstance()->isLocalUserAdministrationEnabled()
101 && $DIC->access()->checkAccess('cat_administrate_users', '', $ref_id);
102 }
103
104 public static function _checkAccessToUserLearningProgress(int $ref_id, int $usr_id): bool
105 {
106 global $DIC;
107
108 //Permission to view the Learning Progress of an OrgUnit: Employees
109 if ($DIC->access()->checkAccess('view_learning_progress', '', $ref_id)
110 && in_array($usr_id, ilObjOrgUnitTree::_getInstance()->getEmployees($ref_id, false))
111 ) {
112 return true;
113 }
114 //Permission to view the Learning Progress of an OrgUnit: Superiors
115 if ($DIC->access()->checkAccess('view_learning_progress', '', $ref_id)
116 && in_array($usr_id, ilObjOrgUnitTree::_getInstance()->getSuperiors($ref_id, false))
117 ) {
118 return true;
119 }
120
121 //Permission to view the Learning Progress of an OrgUnit or SubOrgUnit!: Employees
122 if ($DIC->access()->checkAccess('view_learning_progress_rec', '', $ref_id)
123 && in_array($usr_id, ilObjOrgUnitTree::_getInstance()->getEmployees($ref_id, true))
124 ) {
125 return true;
126 }
127
128 //Permission to view the Learning Progress of an OrgUnit or SubOrgUnit!: Superiors
129 if ($DIC->access()->checkAccess('view_learning_progress_rec', '', $ref_id)
130 && in_array($usr_id, ilObjOrgUnitTree::_getInstance()->getSuperiors($ref_id, true))
131 ) {
132 return true;
133 }
134
135 return false;
136 }
137
138
139 public static function _checkGoto(string $a_target): bool
140 {
141 global $DIC;
142
143 $t_arr = explode('_', $a_target);
144 if ($t_arr[0] !== 'orgu' || ((int) $t_arr[1]) <= 0) {
145 return false;
146 }
147 if ($DIC->access()->checkAccess('read', '', $t_arr[1])) {
148 return true;
149 }
150
151 return false;
152 }
153}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getCommands()
get commands this method returns an array of all possible commands/permission combinations example: $...
static _checkAccessToUserLearningProgress(int $ref_id, int $usr_id)
static _checkGoto(string $a_target)
check whether goto script will succeed
static _checkAccessTypes(int $ref_id)
static _checkAccessStaffRec(int $ref_id)
static _checkAccessAdministrateUsers(int $ref_id)
static _checkAccessExport(int $ref_id)
static _checkAccessSettings(int $ref_id)
static _checkAccessPositions(int $ref_id)
static _checkAccessStaff(int $ref_id)
Class ilObjectAccess.
$ref_id
Definition: ltiauth.php:66
global $DIC
Definition: shib_login.php:26