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