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