ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
class.ilMyStaffCachedAccessDecorator.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\MyStaff;
22
25
27{
28 private Container $dic;
30
32 {
34 $this->dic = $dic;
35 $this->origin = $origin;
36 }
37
38 public function hasCurrentUserAccessToMyStaff(): bool
39 {
40 static $cache = null;
41
42 if (null === $cache) {
43 $cache = (
44 (!$this->dic->user()->isAnonymous() && $this->dic->user()->getId() > 0) &&
45 $this->origin->hasCurrentUserAccessToMyStaff()
46 );
47 }
48
49 return $cache;
50 }
51
52 public function hasCurrentUserAccessToCertificates(): bool
53 {
54 static $cache = null;
55
56 if (null === $cache) {
57 $cache = $this->origin->hasCurrentUserAccessToCertificates();
58 }
59
60 return $cache;
61 }
62
63 public function hasCurrentUserAccessToTalks(): bool
64 {
65 static $cache = null;
66
67 if (null === $cache) {
68 $cache = $this->origin->hasCurrentUserAccessToTalks();
69 }
70
71 return $cache;
72 }
73
74 public function hasCurrentUserAccessToCompetences(): bool
75 {
76 static $cache = null;
77
78 if (null === $cache) {
79 $cache = $this->origin->hasCurrentUserAccessToCompetences();
80 }
81
82 return $cache;
83 }
84
86 {
87 static $cache = null;
88
89 if (null === $cache) {
90 $cache = $this->origin->hasCurrentUserAccessToCourseMemberships();
91 }
92
93 return $cache;
94 }
95
96 public function hasCurrentUserAccessToStaffList(): bool
97 {
98 static $cache = [];
99
100 if (null === $cache) {
101 $cache = $this->origin->hasCurrentUserAccessToStaffList();
102 }
103
104 return $cache;
105 }
106
107 public function hasCurrentUserAccessToUser(int $usr_id = 0): bool
108 {
109 static $cache = [];
110
111 if (!isset($cache[$usr_id])) {
112 $cache[$usr_id] = $this->origin->hasCurrentUserAccessToUser($usr_id);
113 }
114
115 return $cache[$usr_id];
116 }
117
119 {
120 static $cache = [];
121
122 if (!isset($cache[$ref_id])) {
123 $cache[$ref_id] = $this->origin->hasCurrentUserAccessToLearningProgressInObject($ref_id);
124 }
125
126 return $cache[$ref_id];
127 }
128
130 {
131 static $cache = null;
132
133 if (null === $cache) {
134 $cache = $this->origin->hasCurrentUserAccessToCourseLearningProgressForAtLeastOneUser();
135 }
136
137 return $cache;
138 }
139
141 int $position_id,
142 int $operation_id,
143 int $context_id
144 ): bool {
145 static $cache = [];
146
147 $cache_key = implode('#', [$position_id, $operation_id, $context_id]);
148
149 if (!isset($cache[$cache_key])) {
150 $cache[$cache_key] = $this->origin->hasPositionDefaultPermissionForOperationInContext(
151 $position_id,
152 $operation_id,
153 $context_id
154 );
155 }
156
157 return $cache[$cache_key];
158 }
159
161 {
162 return $this->origin->countOrgusOfUserWithAtLeastOneOperation($user_id);
163 }
164
166 int $user_id,
167 string $org_unit_operation_string,
168 string $context
169 ): int {
170 return $this->origin->countOrgusOfUserWithOperationAndContext(
171 $user_id,
172 $org_unit_operation_string,
173 $context
174 );
175 }
176
177
179 int $user_id,
180 string $org_unit_operation_string,
181 string $context,
182 string $tmp_table_name_prefix = self::TMP_DEFAULT_TABLE_NAME_PREFIX_IL_OBJ_USER_MATRIX
183 ): array {
184 return $this->origin->getUsersForUserOperationAndContext(
185 $user_id,
186 $org_unit_operation_string,
187 $context,
188 $tmp_table_name_prefix
189 );
190 }
191
192
193 public function getUsersForUserPerPosition(int $user_id): array
194 {
195 return $this->origin->getUsersForUserPerPosition($user_id);
196 }
197
198
199 public function getUsersForUser(int $user_id, ?int $position_id = null): array
200 {
201 return $this->origin->getUsersForUser($user_id, $position_id);
202 }
203
204
205 public function getIdsForUserAndOperation(int $user_id, string $operation, bool $return_ref_id = false): array
206 {
207 return $this->origin->getIdsForUserAndOperation(
208 $user_id,
209 $operation,
210 $return_ref_id
211 );
212 }
213
214
215 public function getIdsForPositionAndOperation(int $position_id, string $operation, bool $return_ref_id): array
216 {
217 return $this->origin->getIdsForPositionAndOperation(
218 $position_id,
219 $operation,
220 $return_ref_id
221 );
222 }
223
224
226 int $position_id,
227 string $operation,
228 string $context,
229 bool $return_ref_id
230 ): array {
231 return $this->origin->getIdsForPositionAndOperationAndContext(
232 $position_id,
233 $operation,
234 $context,
235 $return_ref_id
236 );
237 }
238
239
241 int $user_id,
242 string $org_unit_operation_string,
243 string $context
244 ): array {
245 return $this->origin->getIlobjectsAndUsersForUserOperationAndContext(
246 $user_id,
247 $org_unit_operation_string,
248 $context
249 );
250 }
251
252
254 int $user_id,
255 string $org_unit_operation_string,
256 string $context,
257 string $temporary_table_name_prefix = self::TMP_DEFAULT_TABLE_NAME_PREFIX_IL_OBJ_USER_MATRIX
258 ): string {
259 return $this->origin->buildTempTableIlobjectsUserMatrixForUserOperationAndContext(
260 $user_id,
261 $org_unit_operation_string,
262 $context,
263 $temporary_table_name_prefix
264 );
265 }
266
267
269 string $org_unit_operation_string,
270 string $context,
271 string $temporary_table_name_prefix = self::TMP_DEFAULT_TABLE_NAME_PREFIX_IL_OBJ_SPEC_PERMISSIONS
272 ): string {
273 return $this->origin->buildTempTableIlobjectsSpecificPermissionSetForOperationAndContext(
274 $org_unit_operation_string,
275 $context,
276 $temporary_table_name_prefix
277 );
278 }
279
280
282 string $org_unit_operation_string,
283 string $context,
284 string $temporary_table_name_prefix = self::TMP_DEFAULT_TABLE_NAME_PREFIX_IL_OBJ_DEFAULT_PERMISSIONS
285 ): string {
286 return $this->origin->buildTempTableIlobjectsDefaultPermissionSetForOperationAndContext(
287 $org_unit_operation_string,
288 $context,
289 $temporary_table_name_prefix
290 );
291 }
292
293
295 string $org_unit_operation_string,
296 string $context,
297 string $temporary_table_name_prefix = self::TMP_DEFAULT_TABLE_NAME_PREFIX_IL_ORGU_DEFAULT_PERMISSIONS
298 ): string {
299 return $this->origin->buildTempTableIlorgunitDefaultPermissionSetForOperationAndContext(
300 $org_unit_operation_string,
301 $context,
302 $temporary_table_name_prefix
303 );
304 }
305
306
308 string $temporary_table_name_prefix = self::TMP_DEFAULT_TABLE_NAME_PREFIX_CRS_MEMBERS,
309 array $only_courses_of_user_ids = []
310 ): string {
311 return $this->origin->buildTempTableCourseMemberships(
312 $temporary_table_name_prefix,
313 $only_courses_of_user_ids
314 );
315 }
316
317
319 string $temporary_table_name_prefix = self::TMP_DEFAULT_TABLE_NAME_PREFIX_ORGU_MEMBERS,
320 array $only_orgus_of_user_ids = []
321 ): string {
322 return $this->origin->buildTempTableOrguMemberships(
323 $temporary_table_name_prefix,
324 $only_orgus_of_user_ids
325 );
326 }
327
328
329 public function dropTempTable(string $temporary_table_name): void
330 {
331 $this->origin->dropTempTable($temporary_table_name);
332 }
333}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
getIdsForPositionAndOperation(int $position_id, string $operation, bool $return_ref_id)
buildTempTableIlobjectsDefaultPermissionSetForOperationAndContext(string $org_unit_operation_string, string $context, string $temporary_table_name_prefix=self::TMP_DEFAULT_TABLE_NAME_PREFIX_IL_OBJ_DEFAULT_PERMISSIONS)
buildTempTableIlobjectsUserMatrixForUserOperationAndContext(int $user_id, string $org_unit_operation_string, string $context, string $temporary_table_name_prefix=self::TMP_DEFAULT_TABLE_NAME_PREFIX_IL_OBJ_USER_MATRIX)
buildTempTableOrguMemberships(string $temporary_table_name_prefix=self::TMP_DEFAULT_TABLE_NAME_PREFIX_ORGU_MEMBERS, array $only_orgus_of_user_ids=[])
buildTempTableIlobjectsSpecificPermissionSetForOperationAndContext(string $org_unit_operation_string, string $context, string $temporary_table_name_prefix=self::TMP_DEFAULT_TABLE_NAME_PREFIX_IL_OBJ_SPEC_PERMISSIONS)
buildTempTableIlorgunitDefaultPermissionSetForOperationAndContext(string $org_unit_operation_string, string $context, string $temporary_table_name_prefix=self::TMP_DEFAULT_TABLE_NAME_PREFIX_IL_ORGU_DEFAULT_PERMISSIONS)
countOrgusOfUserWithOperationAndContext(int $user_id, string $org_unit_operation_string, string $context)
getIdsForUserAndOperation(int $user_id, string $operation, bool $return_ref_id=false)
getIdsForPositionAndOperationAndContext(int $position_id, string $operation, string $context, bool $return_ref_id)
hasPositionDefaultPermissionForOperationInContext(int $position_id, int $operation_id, int $context_id)
getIlobjectsAndUsersForUserOperationAndContext(int $user_id, string $org_unit_operation_string, string $context)
getUsersForUserOperationAndContext(int $user_id, string $org_unit_operation_string, string $context, string $tmp_table_name_prefix=self::TMP_DEFAULT_TABLE_NAME_PREFIX_IL_OBJ_USER_MATRIX)
buildTempTableCourseMemberships(string $temporary_table_name_prefix=self::TMP_DEFAULT_TABLE_NAME_PREFIX_CRS_MEMBERS, array $only_courses_of_user_ids=[])
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:66
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...