ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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 hasCurrentUserAccessToUser(int $usr_id = 0): bool
111  {
112  static $cache = [];
113 
114  if (!isset($cache[$usr_id])) {
115  $cache[$usr_id] = $this->origin->hasCurrentUserAccessToUser($usr_id);
116  }
117 
118  return $cache[$usr_id];
119  }
120 
122  {
123  static $cache = [];
124 
125  if (!isset($cache[$ref_id])) {
126  $cache[$ref_id] = $this->origin->hasCurrentUserAccessToLearningProgressInObject($ref_id);
127  }
128 
129  return $cache[$ref_id];
130  }
131 
133  {
134  static $cache = null;
135 
136  if (null === $cache) {
137  $cache = $this->origin->hasCurrentUserAccessToCourseLearningProgressForAtLeastOneUser();
138  }
139 
140  return $cache;
141  }
142 
144  int $position_id,
145  int $operation_id,
146  int $context_id
147  ): bool {
148  static $cache = [];
149 
150  $cache_key = implode('#', [$position_id, $operation_id, $context_id]);
151 
152  if (!isset($cache[$cache_key])) {
153  $cache[$cache_key] = $this->origin->hasPositionDefaultPermissionForOperationInContext(
154  $position_id,
155  $operation_id,
156  $context_id
157  );
158  }
159 
160  return $cache[$cache_key];
161  }
162 
163  public function countOrgusOfUserWithAtLeastOneOperation(int $user_id): int
164  {
165  return $this->origin->countOrgusOfUserWithAtLeastOneOperation($user_id);
166  }
167 
169  int $user_id,
170  string $org_unit_operation_string,
171  string $context
172  ): int {
173  return $this->origin->countOrgusOfUserWithOperationAndContext(
174  $user_id,
175  $org_unit_operation_string,
176  $context
177  );
178  }
179 
180 
182  int $user_id,
183  string $org_unit_operation_string,
184  string $context,
185  string $tmp_table_name_prefix = self::TMP_DEFAULT_TABLE_NAME_PREFIX_IL_OBJ_USER_MATRIX
186  ): array {
187  return $this->origin->getUsersForUserOperationAndContext(
188  $user_id,
189  $org_unit_operation_string,
190  $context,
191  $tmp_table_name_prefix
192  );
193  }
194 
195 
196  public function getUsersForUserPerPosition(int $user_id): array
197  {
198  return $this->origin->getUsersForUserPerPosition($user_id);
199  }
200 
201 
202  public function getUsersForUser(int $user_id, ?int $position_id = null): array
203  {
204  return $this->origin->getUsersForUser($user_id, $position_id);
205  }
206 
207 
208  public function getIdsForUserAndOperation(int $user_id, string $operation, bool $return_ref_id = false): array
209  {
210  return $this->origin->getIdsForUserAndOperation(
211  $user_id,
212  $operation,
213  $return_ref_id
214  );
215  }
216 
217 
218  public function getIdsForPositionAndOperation(int $position_id, string $operation, bool $return_ref_id): array
219  {
220  return $this->origin->getIdsForPositionAndOperation(
221  $position_id,
222  $operation,
223  $return_ref_id
224  );
225  }
226 
227 
229  int $position_id,
230  string $operation,
231  string $context,
232  bool $return_ref_id
233  ): array {
234  return $this->origin->getIdsForPositionAndOperationAndContext(
235  $position_id,
236  $operation,
237  $context,
238  $return_ref_id
239  );
240  }
241 
242 
244  int $user_id,
245  string $org_unit_operation_string,
246  string $context
247  ): array {
248  return $this->origin->getIlobjectsAndUsersForUserOperationAndContext(
249  $user_id,
250  $org_unit_operation_string,
251  $context
252  );
253  }
254 
255 
257  int $user_id,
258  string $org_unit_operation_string,
259  string $context,
260  string $temporary_table_name_prefix = self::TMP_DEFAULT_TABLE_NAME_PREFIX_IL_OBJ_USER_MATRIX
261  ): string {
262  return $this->origin->buildTempTableIlobjectsUserMatrixForUserOperationAndContext(
263  $user_id,
264  $org_unit_operation_string,
265  $context,
266  $temporary_table_name_prefix
267  );
268  }
269 
270 
272  string $org_unit_operation_string,
273  string $context,
274  string $temporary_table_name_prefix = self::TMP_DEFAULT_TABLE_NAME_PREFIX_IL_OBJ_SPEC_PERMISSIONS
275  ): string {
276  return $this->origin->buildTempTableIlobjectsSpecificPermissionSetForOperationAndContext(
277  $org_unit_operation_string,
278  $context,
279  $temporary_table_name_prefix
280  );
281  }
282 
283 
285  string $org_unit_operation_string,
286  string $context,
287  string $temporary_table_name_prefix = self::TMP_DEFAULT_TABLE_NAME_PREFIX_IL_OBJ_DEFAULT_PERMISSIONS
288  ): string {
289  return $this->origin->buildTempTableIlobjectsDefaultPermissionSetForOperationAndContext(
290  $org_unit_operation_string,
291  $context,
292  $temporary_table_name_prefix
293  );
294  }
295 
296 
298  string $org_unit_operation_string,
299  string $context,
300  string $temporary_table_name_prefix = self::TMP_DEFAULT_TABLE_NAME_PREFIX_IL_ORGU_DEFAULT_PERMISSIONS
301  ): string {
302  return $this->origin->buildTempTableIlorgunitDefaultPermissionSetForOperationAndContext(
303  $org_unit_operation_string,
304  $context,
305  $temporary_table_name_prefix
306  );
307  }
308 
309 
311  string $temporary_table_name_prefix = self::TMP_DEFAULT_TABLE_NAME_PREFIX_CRS_MEMBERS,
312  array $only_courses_of_user_ids = []
313  ): string {
314  return $this->origin->buildTempTableCourseMemberships(
315  $temporary_table_name_prefix,
316  $only_courses_of_user_ids
317  );
318  }
319 
320 
322  string $temporary_table_name_prefix = self::TMP_DEFAULT_TABLE_NAME_PREFIX_ORGU_MEMBERS,
323  array $only_orgus_of_user_ids = []
324  ): string {
325  return $this->origin->buildTempTableOrguMemberships(
326  $temporary_table_name_prefix,
327  $only_orgus_of_user_ids
328  );
329  }
330 
331 
332  public function dropTempTable(string $temporary_table_name): void
333  {
334  $this->origin->dropTempTable($temporary_table_name);
335  }
336 }
buildTempTableCourseMemberships(string $temporary_table_name_prefix=self::TMP_DEFAULT_TABLE_NAME_PREFIX_CRS_MEMBERS, array $only_courses_of_user_ids=[])
$context
Definition: webdav.php:29
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:31
$ref_id
Definition: ltiauth.php:67
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)
__construct(Container $dic, ilPlugin $plugin)
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...