Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

UserHandler.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\Persistence\Cache;
8
9 use eZ\Publish\SPI\Persistence\User\UserTokenUpdateStruct;
10 use eZ\Publish\SPI\Persistence\User\Handler as UserHandlerInterface;
11 use eZ\Publish\SPI\Persistence\User;
12 use eZ\Publish\SPI\Persistence\User\Role;
13 use eZ\Publish\SPI\Persistence\User\RoleAssignment;
14 use eZ\Publish\SPI\Persistence\User\RoleCreateStruct;
15 use eZ\Publish\SPI\Persistence\User\RoleUpdateStruct;
16 use eZ\Publish\SPI\Persistence\User\Policy;
17
21 class UserHandler extends AbstractInMemoryPersistenceHandler implements UserHandlerInterface
22 {
23 private const CONTENT_IDENTIFIER = 'content';
24 private const USER_IDENTIFIER = 'user';
25 private const USER_WITH_BY_LOGIN_SUFFIX_IDENTIFIER = 'user_with_by_login_suffix';
26 private const ROLE_IDENTIFIER = 'role';
27 private const POLICY_IDENTIFIER = 'policy';
28 private const ROLE_WITH_BY_ID_SUFFIX_IDENTIFIER = 'role_with_by_id_suffix';
29 private const ROLE_ASSIGNMENT_IDENTIFIER = 'role_assignment';
30 private const ROLE_ASSIGNMENT_GROUP_LIST_IDENTIFIER = 'role_assignment_group_list';
31 private const ROLE_ASSIGNMENT_ROLE_LIST_IDENTIFIER = 'role_assignment_role_list';
32 private const USER_WITH_BY_EMAIL_SUFFIX_IDENTIFIER = 'user_with_by_email_suffix';
33 private const BY_LOGIN_SUFFIX = 'by_login_suffix';
34 private const BY_IDENTIFIER_SUFFIX = 'by_identifier_suffix';
35 private const LOCATION_PATH_IDENTIFIER = 'location_path';
36 private const ROLE_ASSIGNMENT_WITH_BY_ROLE_SUFFIX_IDENTIFIER = 'role_assignment_with_by_role_suffix';
37 private const ROLE_ASSIGNMENT_WITH_BY_GROUP_INHERITED_SUFFIX_IDENTIFIER = 'role_assignment_with_by_group_inherited_suffix';
38 private const ROLE_ASSIGNMENT_WITH_BY_GROUP_SUFFIX_IDENTIFIER = 'role_assignment_with_by_group_suffix';
39 private const USER_WITH_ACCOUNT_KEY_SUFFIX_IDENTIFIER = 'user_with_account_key_suffix';
40 private const USER_WITH_BY_ACCOUNT_KEY_SUFFIX_IDENTIFIER = 'user_with_by_account_key_suffix';
41 private const BY_ACCOUNT_KEY_SUFFIX = 'by_account_key_suffix';
42
44 private $getUserTags;
45
47 private $getUserKeys;
48
50 private $getRoleTags;
51
53 private $getRoleKeys;
54
56 private $getRoleAssignmentTags;
57
59 private $getRoleAssignmentKeys;
60
64 public function init(): void
65 {
66 $this->getUserTags = function (User $user) {
67 return [
68 $this->cacheIdentifierGenerator->generateTag(self::CONTENT_IDENTIFIER, [$user->id]),
69 $this->cacheIdentifierGenerator->generateTag(self::USER_IDENTIFIER, [$user->id]),
70 ];
71 };
72 $this->getUserKeys = function (User $user) {
73 return [
74 $this->cacheIdentifierGenerator->generateKey(self::USER_IDENTIFIER, [$user->id], true),
75 $this->cacheIdentifierGenerator->generateKey(
76 self::USER_WITH_BY_LOGIN_SUFFIX_IDENTIFIER,
77 [$this->cacheIdentifierSanitizer->escapeForCacheKey($user->login)],
78 true
79 ),
80 //'ez-user-' . $hash . '-by-account-key',
81 ];
82 };
83 $this->getRoleTags = function (Role $role) {
84 return [
85 $this->cacheIdentifierGenerator->generateTag(self::ROLE_IDENTIFIER, [$role->id]),
86 ];
87 };
88 $this->getRoleKeys = function (Role $role) {
89 return [
90 $this->cacheIdentifierGenerator->generateKey(self::ROLE_IDENTIFIER, [$role->id], true),
91 $this->cacheIdentifierGenerator->generateKey(
92 self::ROLE_WITH_BY_ID_SUFFIX_IDENTIFIER,
93 [$this->cacheIdentifierSanitizer->escapeForCacheKey($role->identifier)],
94 true
95 ),
96 ];
97 };
98 $this->getRoleAssignmentTags = function (RoleAssignment $roleAssignment) {
99 return [
100 $this->cacheIdentifierGenerator->generateTag(self::ROLE_ASSIGNMENT_IDENTIFIER, [$roleAssignment->id]),
101 $this->cacheIdentifierGenerator->generateTag(self::ROLE_ASSIGNMENT_GROUP_LIST_IDENTIFIER, [$roleAssignment->contentId]),
102 $this->cacheIdentifierGenerator->generateTag(self::ROLE_ASSIGNMENT_ROLE_LIST_IDENTIFIER, [$roleAssignment->roleId]),
103 ];
104 };
105 $this->getRoleAssignmentKeys = function (RoleAssignment $roleAssignment) {
106 return [
107 $this->cacheIdentifierGenerator->generateKey(self::ROLE_ASSIGNMENT_IDENTIFIER, [$roleAssignment->id], true),
108 ];
109 };
110 }
111
115 public function create(User $user)
116 {
117 $this->logger->logCall(__METHOD__, ['struct' => $user]);
118 $return = $this->persistenceHandler->userHandler()->create($user);
119
120 // Clear corresponding content cache as creation of the User changes it's external data
121 $this->cache->invalidateTags([
122 $this->cacheIdentifierGenerator->generateTag(self::CONTENT_IDENTIFIER, [$user->id]),
123 ]);
124
125 $this->cache->deleteItems([
126 $this->cacheIdentifierGenerator->generateKey(self::USER_IDENTIFIER, [$user->id], true),
127 $this->cacheIdentifierGenerator->generateKey(
128 self::USER_WITH_BY_LOGIN_SUFFIX_IDENTIFIER,
129 [$this->cacheIdentifierSanitizer->escapeForCacheKey($user->login)],
130 true
131 ),
132 $this->cacheIdentifierGenerator->generateKey(
133 self::USER_WITH_BY_EMAIL_SUFFIX_IDENTIFIER,
134 [$this->cacheIdentifierSanitizer->escapeForCacheKey($user->email)],
135 true
136 ),
137 ]);
138
139 return $return;
140 }
141
145 public function load($userId)
146 {
147 return $this->getCacheValue(
148 $userId,
149 $this->cacheIdentifierGenerator->generateKey(self::USER_IDENTIFIER, [], true) . '-',
150 function ($userId) {
151 return $this->persistenceHandler->userHandler()->load($userId);
152 },
153 $this->getUserTags,
154 $this->getUserKeys
155 );
156 }
157
161 public function loadByLogin($login)
162 {
163 return $this->getCacheValue(
164 $this->cacheIdentifierSanitizer->escapeForCacheKey($login),
165 $this->cacheIdentifierGenerator->generateKey(self::USER_IDENTIFIER, [], true) . '-',
166 function () use ($login) {
167 return $this->persistenceHandler->userHandler()->loadByLogin($login);
168 },
169 $this->getUserTags,
170 $this->getUserKeys,
171 '-' . $this->cacheIdentifierGenerator->generateKey(self::BY_LOGIN_SUFFIX)
172 );
173 }
174
178 public function loadByEmail($email)
179 {
180 // As load by email can return several items we threat it like a list here.
181 return $this->getListCacheValue(
182 $this->cacheIdentifierGenerator->generateKey(
183 self::USER_WITH_BY_EMAIL_SUFFIX_IDENTIFIER,
184 [$this->cacheIdentifierSanitizer->escapeForCacheKey($email)],
185 true
186 ),
187 function () use ($email) {
188 return $this->persistenceHandler->userHandler()->loadByEmail($email);
189 },
190 $this->getUserTags,
191 $this->getUserKeys
192 );
193 }
194
198 public function loadUserByToken($hash)
199 {
200 $getUserKeysFn = $this->getUserKeys;
201 $getUserTagsFn = $this->getUserTags;
202
203 return $this->getCacheValue(
204 $hash,
205 $this->cacheIdentifierGenerator->generateKey(self::USER_IDENTIFIER, [], true) . '-',
206 function ($hash) {
207 return $this->persistenceHandler->userHandler()->loadUserByToken($hash);
208 },
209 function (User $user) use ($getUserTagsFn) {
210 $tags = $getUserTagsFn($user);
211 // See updateUserToken()
212 $tags[] = $this->cacheIdentifierGenerator->generateTag(self::USER_WITH_ACCOUNT_KEY_SUFFIX_IDENTIFIER, [$user->id]);
213
214 return $tags;
215 },
216 function (User $user) use ($hash, $getUserKeysFn) {
217 $keys = $getUserKeysFn($user);
218 $keys[] = $this->cacheIdentifierGenerator->generateKey(self::USER_WITH_BY_ACCOUNT_KEY_SUFFIX_IDENTIFIER, [$hash], true);
219
220 return $keys;
221 },
222 $this->cacheIdentifierGenerator->generateKey(self::BY_ACCOUNT_KEY_SUFFIX)
223 );
224 }
225
229 public function update(User $user)
230 {
231 $this->logger->logCall(__METHOD__, ['struct' => $user]);
232 $return = $this->persistenceHandler->userHandler()->update($user);
233
234 // Clear corresponding content cache as update of the User changes it's external data
235 $this->cache->invalidateTags([
236 $this->cacheIdentifierGenerator->generateTag(self::CONTENT_IDENTIFIER, [$user->id]),
237 $this->cacheIdentifierGenerator->generateTag(self::USER_IDENTIFIER, [$user->id]),
238 ]);
239
240 // Clear especially by email key as it might already be cached and this might represent change to email
241 $this->cache->deleteItems([
242 $this->cacheIdentifierGenerator->generateKey(
243 self::USER_WITH_BY_EMAIL_SUFFIX_IDENTIFIER,
244 [$this->cacheIdentifierSanitizer->escapeForCacheKey($user->email)],
245 true
246 ),
247 ]);
248
249 return $return;
250 }
251
255 public function updateUserToken(UserTokenUpdateStruct $userTokenUpdateStruct)
256 {
257 $this->logger->logCall(__METHOD__, ['struct' => $userTokenUpdateStruct]);
258 $return = $this->persistenceHandler->userHandler()->updateUserToken($userTokenUpdateStruct);
259
260 // As we 1. don't know original hash, and 2. hash is not guaranteed to be unique, we do it like this for now
261 $this->cache->invalidateTags([
262 $this->cacheIdentifierGenerator->generateTag(self::USER_WITH_ACCOUNT_KEY_SUFFIX_IDENTIFIER, [$userTokenUpdateStruct->userId]),
263 ]);
264
265 $this->cache->deleteItems([
266 $this->cacheIdentifierGenerator->generateKey(
267 self::USER_WITH_BY_ACCOUNT_KEY_SUFFIX_IDENTIFIER,
268 [$userTokenUpdateStruct->hashKey],
269 true
270 ),
271 ]);
272
273 return $return;
274 }
275
279 public function expireUserToken($hash)
280 {
281 $this->logger->logCall(__METHOD__, ['hash' => $hash]);
282 $return = $this->persistenceHandler->userHandler()->expireUserToken($hash);
283
284 $this->cache->deleteItems([
285 $this->cacheIdentifierGenerator->generateKey(self::USER_WITH_BY_ACCOUNT_KEY_SUFFIX_IDENTIFIER, [$hash], true),
286 ]);
287
288 return $return;
289 }
290
294 public function delete($userId)
295 {
296 $this->logger->logCall(__METHOD__, ['user' => $userId]);
297 $return = $this->persistenceHandler->userHandler()->delete($userId);
298
299 // user id == content id == group id
300 $this->cache->invalidateTags([
301 $this->cacheIdentifierGenerator->generateTag(self::CONTENT_IDENTIFIER, [$userId]),
302 $this->cacheIdentifierGenerator->generateTag(self::USER_IDENTIFIER, [$userId]),
303 ]);
304
305 return $return;
306 }
307
311 public function createRole(RoleCreateStruct $createStruct)
312 {
313 $this->logger->logCall(__METHOD__, ['struct' => $createStruct]);
314
315 return $this->persistenceHandler->userHandler()->createRole($createStruct);
316 }
317
321 public function createRoleDraft($roleId)
322 {
323 $this->logger->logCall(__METHOD__, ['role' => $roleId]);
324
325 return $this->persistenceHandler->userHandler()->createRoleDraft($roleId);
326 }
327
331 public function loadRole($roleId, $status = Role::STATUS_DEFINED)
332 {
333 if ($status !== Role::STATUS_DEFINED) {
334 $this->logger->logCall(__METHOD__, ['role' => $roleId]);
335
336 return $this->persistenceHandler->userHandler()->loadRole($roleId, $status);
337 }
338
339 return $this->getCacheValue(
340 $roleId,
341 $this->cacheIdentifierGenerator->generateKey(self::ROLE_IDENTIFIER, [], true) . '-',
342 function ($roleId) {
343 return $this->persistenceHandler->userHandler()->loadRole($roleId);
344 },
345 $this->getRoleTags,
346 $this->getRoleKeys
347 );
348 }
349
353 public function loadRoleByIdentifier($identifier, $status = Role::STATUS_DEFINED)
354 {
355 if ($status !== Role::STATUS_DEFINED) {
356 $this->logger->logCall(__METHOD__, ['role' => $identifier]);
357
358 return $this->persistenceHandler->userHandler()->loadRoleByIdentifier($identifier, $status);
359 }
360
361 return $this->getCacheValue(
362 $this->cacheIdentifierSanitizer->escapeForCacheKey($identifier),
363 $this->cacheIdentifierGenerator->generateKey(self::ROLE_IDENTIFIER, [], true) . '-',
364 function () use ($identifier) {
365 return $this->persistenceHandler->userHandler()->loadRoleByIdentifier($identifier);
366 },
367 $this->getRoleTags,
368 $this->getRoleKeys,
369 $this->cacheIdentifierGenerator->generateKey(self::BY_IDENTIFIER_SUFFIX)
370 );
371 }
372
376 public function loadRoleDraftByRoleId($roleId)
377 {
378 $this->logger->logCall(__METHOD__, ['role' => $roleId]);
379
380 return $this->persistenceHandler->userHandler()->loadRoleDraftByRoleId($roleId);
381 }
382
386 public function loadRoles()
387 {
388 $this->logger->logCall(__METHOD__);
389
390 return $this->persistenceHandler->userHandler()->loadRoles();
391 }
392
396 public function loadRoleAssignment($roleAssignmentId)
397 {
398 return $this->getCacheValue(
399 $roleAssignmentId,
400 $this->cacheIdentifierGenerator->generateKey(self::ROLE_ASSIGNMENT_IDENTIFIER, [], true) . '-',
401 function ($roleAssignmentId) {
402 return $this->persistenceHandler->userHandler()->loadRoleAssignment($roleAssignmentId);
403 },
404 $this->getRoleAssignmentTags,
405 $this->getRoleAssignmentKeys
406 );
407 }
408
412 public function loadRoleAssignmentsByRoleId($roleId)
413 {
414 return $this->getListCacheValue(
415 $this->cacheIdentifierGenerator->generateKey(self::ROLE_ASSIGNMENT_WITH_BY_ROLE_SUFFIX_IDENTIFIER, [$roleId], true),
416 function () use ($roleId) {
417 return $this->persistenceHandler->userHandler()->loadRoleAssignmentsByRoleId($roleId);
418 },
419 $this->getRoleAssignmentTags,
420 $this->getRoleAssignmentKeys,
421 /* Role update (policies) changes role assignment id, also need list tag in case of empty result */
422 function () use ($roleId) {
423 return [
424 $this->cacheIdentifierGenerator->generateTag(self::ROLE_ASSIGNMENT_ROLE_LIST_IDENTIFIER, [$roleId]),
425 $this->cacheIdentifierGenerator->generateTag(self::ROLE_IDENTIFIER, [$roleId]),
426 ];
427 },
428 [$roleId]
429 );
430 }
431
435 public function loadRoleAssignmentsByGroupId($groupId, $inherit = false)
436 {
437 $innerHandler = $this->persistenceHandler;
438 if ($inherit) {
439 $key = $this->cacheIdentifierGenerator->generateKey(
440 self::ROLE_ASSIGNMENT_WITH_BY_GROUP_INHERITED_SUFFIX_IDENTIFIER,
441 [$groupId],
442 true
443 );
444 } else {
445 $key = $this->cacheIdentifierGenerator->generateKey(
446 self::ROLE_ASSIGNMENT_WITH_BY_GROUP_SUFFIX_IDENTIFIER,
447 [$groupId],
448 true
449 );
450 }
451
452 return $this->getListCacheValue(
453 $key,
454 function () use ($groupId, $inherit) {
455 return $this->persistenceHandler->userHandler()->loadRoleAssignmentsByGroupId($groupId, $inherit);
456 },
457 $this->getRoleAssignmentTags,
458 $this->getRoleAssignmentKeys,
459 function () use ($groupId, $innerHandler) {
460 // Tag needed for empty results, if not empty will alse be added by getRoleAssignmentTags().
461 $cacheTags = [
462 $this->cacheIdentifierGenerator->generateTag(self::ROLE_ASSIGNMENT_GROUP_LIST_IDENTIFIER, [$groupId]),
463 ];
464 // To make sure tree operations affecting this can clear the permission cache
465 $locations = $innerHandler->locationHandler()->loadLocationsByContent($groupId);
466
467 foreach ($locations as $location) {
468 $pathIds = $this->locationPathConverter->convertToPathIds($location->pathString);
469 foreach ($pathIds as $pathId) {
470 $cacheTags[] = $this->cacheIdentifierGenerator->generateTag(self::LOCATION_PATH_IDENTIFIER, [$pathId]);
471 }
472 }
473
474 return $cacheTags;
475 },
476 [$groupId, $inherit]
477 );
478 }
479
483 public function updateRole(RoleUpdateStruct $struct)
484 {
485 $this->logger->logCall(__METHOD__, ['struct' => $struct]);
486 $this->persistenceHandler->userHandler()->updateRole($struct);
487
488 $this->cache->invalidateTags([
489 $this->cacheIdentifierGenerator->generateTag(self::ROLE_IDENTIFIER, [$struct->id]),
490 ]);
491 }
492
496 public function deleteRole($roleId, $status = Role::STATUS_DEFINED)
497 {
498 $this->logger->logCall(__METHOD__, ['role' => $roleId]);
499 $return = $this->persistenceHandler->userHandler()->deleteRole($roleId, $status);
500
501 if ($status === Role::STATUS_DEFINED) {
502 $this->cache->invalidateTags([
503 $this->cacheIdentifierGenerator->generateTag(self::ROLE_IDENTIFIER, [$roleId]),
504 $this->cacheIdentifierGenerator->generateTag(self::ROLE_ASSIGNMENT_ROLE_LIST_IDENTIFIER, [$roleId]),
505 ]);
506 }
507
508 return $return;
509 }
510
514 public function publishRoleDraft($roleDraftId)
515 {
516 $this->logger->logCall(__METHOD__, ['role' => $roleDraftId]);
517 $userHandler = $this->persistenceHandler->userHandler();
518 $roleDraft = $userHandler->loadRole($roleDraftId, Role::STATUS_DRAFT);
519 $return = $userHandler->publishRoleDraft($roleDraftId);
520
521 // If there was a original role for the draft, then we clean cache for it
522 if ($roleDraft->originalId > -1) {
523 $this->cache->invalidateTags([
524 $this->cacheIdentifierGenerator->generateTag(self::ROLE_IDENTIFIER, [$roleDraft->originalId]),
525 ]);
526 }
527
528 return $return;
529 }
530
534 public function addPolicyByRoleDraft($roleId, Policy $policy)
535 {
536 $this->logger->logCall(__METHOD__, ['role' => $roleId, 'struct' => $policy]);
537
538 return $this->persistenceHandler->userHandler()->addPolicyByRoleDraft($roleId, $policy);
539 }
540
544 public function addPolicy($roleId, Policy $policy)
545 {
546 $this->logger->logCall(__METHOD__, ['role' => $roleId, 'struct' => $policy]);
547 $return = $this->persistenceHandler->userHandler()->addPolicy($roleId, $policy);
548
549 $this->cache->invalidateTags([
550 $this->cacheIdentifierGenerator->generateTag(self::ROLE_IDENTIFIER, [$roleId]),
551 ]);
552
553 return $return;
554 }
555
559 public function updatePolicy(Policy $policy)
560 {
561 $this->logger->logCall(__METHOD__, ['struct' => $policy]);
562 $return = $this->persistenceHandler->userHandler()->updatePolicy($policy);
563
564 $this->cache->invalidateTags([
565 $this->cacheIdentifierGenerator->generateTag(self::POLICY_IDENTIFIER, [$policy->id]),
566 $this->cacheIdentifierGenerator->generateTag(self::ROLE_IDENTIFIER, [$policy->roleId]),
567 ]);
568
569 return $return;
570 }
571
575 public function deletePolicy($policyId, $roleId)
576 {
577 $this->logger->logCall(__METHOD__, ['policy' => $policyId]);
578 $this->persistenceHandler->userHandler()->deletePolicy($policyId, $roleId);
579
580 $this->cache->invalidateTags([
581 $this->cacheIdentifierGenerator->generateTag(self::POLICY_IDENTIFIER, [$policyId]),
582 $this->cacheIdentifierGenerator->generateTag(self::ROLE_IDENTIFIER, [$roleId]),
583 ]);
584 }
585
589 public function loadPoliciesByUserId($userId)
590 {
591 $this->logger->logCall(__METHOD__, ['user' => $userId]);
592
593 return $this->persistenceHandler->userHandler()->loadPoliciesByUserId($userId);
594 }
595
599 public function assignRole($contentId, $roleId, array $limitation = null)
600 {
601 $this->logger->logCall(__METHOD__, ['group' => $contentId, 'role' => $roleId, 'limitation' => $limitation]);
602 $return = $this->persistenceHandler->userHandler()->assignRole($contentId, $roleId, $limitation);
603
604 $tags = [
605 $this->cacheIdentifierGenerator->generateTag(self::ROLE_ASSIGNMENT_GROUP_LIST_IDENTIFIER, [$contentId]),
606 $this->cacheIdentifierGenerator->generateTag(self::ROLE_ASSIGNMENT_ROLE_LIST_IDENTIFIER, [$roleId]),
607 ];
608
609 $locations = $this->persistenceHandler->locationHandler()->loadLocationsByContent($contentId);
610 foreach ($locations as $location) {
611 $tags[] = $this->cacheIdentifierGenerator->generateTag(self::LOCATION_PATH_IDENTIFIER, [$location->id]);
612 }
613
614 $this->cache->invalidateTags($tags);
615
616 return $return;
617 }
618
622 public function unassignRole($contentId, $roleId)
623 {
624 $this->logger->logCall(__METHOD__, ['group' => $contentId, 'role' => $roleId]);
625 $return = $this->persistenceHandler->userHandler()->unassignRole($contentId, $roleId);
626
627 $this->cache->invalidateTags([
628 $this->cacheIdentifierGenerator->generateTag(self::ROLE_ASSIGNMENT_GROUP_LIST_IDENTIFIER, [$contentId]),
629 $this->cacheIdentifierGenerator->generateTag(self::ROLE_ASSIGNMENT_ROLE_LIST_IDENTIFIER, [$roleId]),
630 ]);
631
632 return $return;
633 }
634
638 public function removeRoleAssignment($roleAssignmentId)
639 {
640 $this->logger->logCall(__METHOD__, ['assignment' => $roleAssignmentId]);
641 $return = $this->persistenceHandler->userHandler()->removeRoleAssignment($roleAssignmentId);
642
643 $this->cache->invalidateTags([
644 $this->cacheIdentifierGenerator->generateTag(self::ROLE_ASSIGNMENT_IDENTIFIER, [$roleAssignmentId]),
645 ]);
646
647 return $return;
648 }
649 }
eZ\Publish\Core\Persistence\Cache\AbstractInMemoryHandler\getListCacheValue
getListCacheValue(string $key, callable $backendLoader, callable $cacheTagger, callable $cacheIndexes, callable $listTags=null, array $arguments=[])
Load list of objects of some type and loggs the hits / misses.
Definition: AbstractInMemoryHandler.php:127
eZ\Publish\Core\Persistence\Cache\AbstractInMemoryHandler\getCacheValue
getCacheValue( $id, string $keyPrefix, callable $backendLoader, callable $cacheTagger, callable $cacheIndexes, string $keySuffix='', array $arguments=[])
Load one cache item from cache and loggs the hits / misses.
Definition: AbstractInMemoryHandler.php:71
eZ\Publish\Core\Persistence\Cache\AbstractInMemoryPersistenceHandler
Internal abstract handler for use in other SPI Persistence Cache Handlers.
Definition: AbstractInMemoryPersistenceHandler.php:22
eZ\Publish\Core\Persistence\Cache\AbstractInMemoryPersistenceHandler\$persistenceHandler
$persistenceHandler
Definition: AbstractInMemoryPersistenceHandler.php:24
eZ\Publish\Core\Persistence\Cache\UserHandler
Cache handler for user module.
Definition: UserHandler.php:22
eZ\Publish\Core\Persistence\Cache\UserHandler\$getUserKeys
$getUserKeys
Definition: UserHandler.php:47
eZ\Publish\Core\Persistence\Cache\UserHandler\$getUserTags
$getUserTags
Definition: UserHandler.php:44
eZ\Publish\Core\Persistence\Cache\UserHandler\ROLE_ASSIGNMENT_WITH_BY_ROLE_SUFFIX_IDENTIFIER
const ROLE_ASSIGNMENT_WITH_BY_ROLE_SUFFIX_IDENTIFIER
Definition: UserHandler.php:36
eZ\Publish\Core\Persistence\Cache\UserHandler\loadRoleDraftByRoleId
loadRoleDraftByRoleId($roleId)
{Loads a role draft by the original role ID.ID of the role the draft was created from....
Definition: UserHandler.php:376
eZ\Publish\Core\Persistence\Cache\UserHandler\init
init()
Set callback functions for use in cache retrival.
Definition: UserHandler.php:64
eZ\Publish\Core\Persistence\Cache\UserHandler\load
load($userId)
{Loads user with user ID.}
Definition: UserHandler.php:145
eZ\Publish\Core\Persistence\Cache\UserHandler\BY_IDENTIFIER_SUFFIX
const BY_IDENTIFIER_SUFFIX
Definition: UserHandler.php:34
eZ\Publish\Core\Persistence\Cache\UserHandler\updateUserToken
updateUserToken(UserTokenUpdateStruct $userTokenUpdateStruct)
{Update the user information specified by the user token struct.}
Definition: UserHandler.php:255
eZ\Publish\Core\Persistence\Cache\UserHandler\USER_IDENTIFIER
const USER_IDENTIFIER
Definition: UserHandler.php:24
eZ\Publish\Core\Persistence\Cache\UserHandler\USER_WITH_BY_LOGIN_SUFFIX_IDENTIFIER
const USER_WITH_BY_LOGIN_SUFFIX_IDENTIFIER
Definition: UserHandler.php:25
eZ\Publish\Core\Persistence\Cache\UserHandler\create
create(User $user)
{Create a user.The User struct used to create the user will contain an ID which is used to reference ...
Definition: UserHandler.php:115
eZ\Publish\Core\Persistence\Cache\UserHandler\ROLE_ASSIGNMENT_WITH_BY_GROUP_SUFFIX_IDENTIFIER
const ROLE_ASSIGNMENT_WITH_BY_GROUP_SUFFIX_IDENTIFIER
Definition: UserHandler.php:38
eZ\Publish\Core\Persistence\Cache\UserHandler\USER_WITH_BY_ACCOUNT_KEY_SUFFIX_IDENTIFIER
const USER_WITH_BY_ACCOUNT_KEY_SUFFIX_IDENTIFIER
Definition: UserHandler.php:40
eZ\Publish\Core\Persistence\Cache\UserHandler\unassignRole
unassignRole($contentId, $roleId)
{Un-assign a role.The user or user group Id to un-assign the role from. }
Definition: UserHandler.php:622
eZ\Publish\Core\Persistence\Cache\UserHandler\createRole
createRole(RoleCreateStruct $createStruct)
{Create new role.\eZ\Publish\SPI\Persistence\User\Role}
Definition: UserHandler.php:311
eZ\Publish\Core\Persistence\Cache\UserHandler\LOCATION_PATH_IDENTIFIER
const LOCATION_PATH_IDENTIFIER
Definition: UserHandler.php:35
eZ\Publish\Core\Persistence\Cache\UserHandler\USER_WITH_ACCOUNT_KEY_SUFFIX_IDENTIFIER
const USER_WITH_ACCOUNT_KEY_SUFFIX_IDENTIFIER
Definition: UserHandler.php:39
eZ\Publish\Core\Persistence\Cache\UserHandler\$getRoleTags
$getRoleTags
Definition: UserHandler.php:50
eZ\Publish\Core\Persistence\Cache\UserHandler\loadRoleByIdentifier
loadRoleByIdentifier($identifier, $status=Role::STATUS_DEFINED)
{Loads a specified role (draft) by $identifier.One of Role::STATUS_DEFINED|Role::STATUS_DRAFT}
Definition: UserHandler.php:353
eZ\Publish\Core\Persistence\Cache\UserHandler\ROLE_WITH_BY_ID_SUFFIX_IDENTIFIER
const ROLE_WITH_BY_ID_SUFFIX_IDENTIFIER
Definition: UserHandler.php:28
eZ\Publish\Core\Persistence\Cache\UserHandler\BY_ACCOUNT_KEY_SUFFIX
const BY_ACCOUNT_KEY_SUFFIX
Definition: UserHandler.php:41
eZ\Publish\Core\Persistence\Cache\UserHandler\updateRole
updateRole(RoleUpdateStruct $struct)
{Update role (draft).}
Definition: UserHandler.php:483
eZ\Publish\Core\Persistence\Cache\UserHandler\loadPoliciesByUserId
loadPoliciesByUserId($userId)
{Returns the user policies associated with the user (including inherited policies from user groups)....
Definition: UserHandler.php:589
eZ\Publish\Core\Persistence\Cache\UserHandler\$getRoleKeys
$getRoleKeys
Definition: UserHandler.php:53
eZ\Publish\Core\Persistence\Cache\UserHandler\loadRoleAssignmentsByGroupId
loadRoleAssignmentsByGroupId($groupId, $inherit=false)
{Loads roles assignments to a user/group.Role Assignments with same roleId and limitationIdentifier w...
Definition: UserHandler.php:435
eZ\Publish\Core\Persistence\Cache\UserHandler\publishRoleDraft
publishRoleDraft($roleDraftId)
{Publish the specified role draft.}
Definition: UserHandler.php:514
eZ\Publish\Core\Persistence\Cache\UserHandler\loadByEmail
loadByEmail($email)
{Loads user(s) with user email.As earlier eZ Publish versions supported several users having same ema...
Definition: UserHandler.php:178
eZ\Publish\Core\Persistence\Cache\UserHandler\loadByLogin
loadByLogin($login)
{Loads user with user login.Note: This method loads user by $login case in-sensitive on certain stora...
Definition: UserHandler.php:161
eZ\Publish\Core\Persistence\Cache\UserHandler\loadUserByToken
loadUserByToken($hash)
{Loads user with user hash.}
Definition: UserHandler.php:198
eZ\Publish\Core\Persistence\Cache\UserHandler\deletePolicy
deletePolicy($policyId, $roleId)
{Removes a policy from a role.Throw exception on missing role / policy? }
Definition: UserHandler.php:575
eZ\Publish\Core\Persistence\Cache\UserHandler\ROLE_ASSIGNMENT_WITH_BY_GROUP_INHERITED_SUFFIX_IDENTIFIER
const ROLE_ASSIGNMENT_WITH_BY_GROUP_INHERITED_SUFFIX_IDENTIFIER
Definition: UserHandler.php:37
eZ\Publish\Core\Persistence\Cache\UserHandler\deleteRole
deleteRole($roleId, $status=Role::STATUS_DEFINED)
{Delete the specified role (draft).One of Role::STATUS_DEFINED|Role::STATUS_DRAFT}
Definition: UserHandler.php:496
eZ\Publish\Core\Persistence\Cache\UserHandler\$getRoleAssignmentTags
$getRoleAssignmentTags
Definition: UserHandler.php:56
eZ\Publish\Core\Persistence\Cache\UserHandler\assignRole
assignRole($contentId, $roleId, array $limitation=null)
{Assigns role to a user or user group with given limitations.The limitation array looks like: array(...
Definition: UserHandler.php:599
eZ\Publish\Core\Persistence\Cache\UserHandler\ROLE_ASSIGNMENT_IDENTIFIER
const ROLE_ASSIGNMENT_IDENTIFIER
Definition: UserHandler.php:29
eZ\Publish\Core\Persistence\Cache\UserHandler\loadRoles
loadRoles()
{Loads all roles.\eZ\Publish\SPI\Persistence\User\Role[]}
Definition: UserHandler.php:386
eZ\Publish\Core\Persistence\Cache\UserHandler\updatePolicy
updatePolicy(Policy $policy)
{Update a policy.Replaces limitations values with new values.}
Definition: UserHandler.php:559
eZ\Publish\Core\Persistence\Cache\UserHandler\loadRole
loadRole($roleId, $status=Role::STATUS_DEFINED)
{Loads a specified role (draft) by $roleId.One of Role::STATUS_DEFINED|Role::STATUS_DRAFT}
Definition: UserHandler.php:331
eZ\Publish\Core\Persistence\Cache\UserHandler\BY_LOGIN_SUFFIX
const BY_LOGIN_SUFFIX
Definition: UserHandler.php:33
eZ\Publish\Core\Persistence\Cache\UserHandler\removeRoleAssignment
removeRoleAssignment($roleAssignmentId)
{Un-assign a role, by assignment ID.The assignment ID.}
Definition: UserHandler.php:638
eZ\Publish\Core\Persistence\Cache\UserHandler\expireUserToken
expireUserToken($hash)
{Expires user token with user hash.}
Definition: UserHandler.php:279
eZ\Publish\Core\Persistence\Cache\UserHandler\loadRoleAssignmentsByRoleId
loadRoleAssignmentsByRoleId($roleId)
{Loads roles assignments Role.Role Assignments with same roleId and limitationIdentifier will be merg...
Definition: UserHandler.php:412
eZ\Publish\Core\Persistence\Cache\UserHandler\addPolicy
addPolicy($roleId, Policy $policy)
{Adds a policy to a role.\eZ\Publish\SPI\Persistence\User\PolicyThrow on invalid Role Id?...
Definition: UserHandler.php:544
eZ\Publish\Core\Persistence\Cache\UserHandler\ROLE_IDENTIFIER
const ROLE_IDENTIFIER
Definition: UserHandler.php:26
eZ\Publish\Core\Persistence\Cache\UserHandler\createRoleDraft
createRoleDraft($roleId)
{Creates a draft of existing defined role.Sets status to Role::STATUS_DRAFT on the new returned draft...
Definition: UserHandler.php:321
eZ\Publish\Core\Persistence\Cache\UserHandler\$getRoleAssignmentKeys
$getRoleAssignmentKeys
Definition: UserHandler.php:59
eZ\Publish\Core\Persistence\Cache\UserHandler\addPolicyByRoleDraft
addPolicyByRoleDraft($roleId, Policy $policy)
{Adds a policy to a role draft.\eZ\Publish\SPI\Persistence\User\PolicyThrow on invalid Role Id?...
Definition: UserHandler.php:534
eZ\Publish\Core\Persistence\Cache\UserHandler\POLICY_IDENTIFIER
const POLICY_IDENTIFIER
Definition: UserHandler.php:27
eZ\Publish\Core\Persistence\Cache\UserHandler\USER_WITH_BY_EMAIL_SUFFIX_IDENTIFIER
const USER_WITH_BY_EMAIL_SUFFIX_IDENTIFIER
Definition: UserHandler.php:32
eZ\Publish\Core\Persistence\Cache\UserHandler\ROLE_ASSIGNMENT_GROUP_LIST_IDENTIFIER
const ROLE_ASSIGNMENT_GROUP_LIST_IDENTIFIER
Definition: UserHandler.php:30
eZ\Publish\Core\Persistence\Cache\UserHandler\update
update(User $user)
{Update the user information specified by the user struct.}
Definition: UserHandler.php:229
eZ\Publish\Core\Persistence\Cache\UserHandler\ROLE_ASSIGNMENT_ROLE_LIST_IDENTIFIER
const ROLE_ASSIGNMENT_ROLE_LIST_IDENTIFIER
Definition: UserHandler.php:31
eZ\Publish\Core\Persistence\Cache\UserHandler\CONTENT_IDENTIFIER
const CONTENT_IDENTIFIER
Definition: UserHandler.php:23
eZ\Publish\Core\Persistence\Cache\UserHandler\loadRoleAssignment
loadRoleAssignment($roleAssignmentId)
{Loads role assignment for specified assignment ID.}
Definition: UserHandler.php:396
eZ\Publish\SPI\Persistence\User\Policy
Definition: SPI/Persistence/User/Policy.php:12
eZ\Publish\SPI\Persistence\User\RoleAssignment
Definition: SPI/Persistence/User/RoleAssignment.php:12
eZ\Publish\SPI\Persistence\User\RoleCreateStruct
Definition: SPI/Persistence/User/RoleCreateStruct.php:12
eZ\Publish\SPI\Persistence\User\RoleUpdateStruct
Definition: SPI/Persistence/User/RoleUpdateStruct.php:12
eZ\Publish\SPI\Persistence\User\Role
Definition: SPI/Persistence/User/Role.php:12
eZ\Publish\SPI\Persistence\User\Role\STATUS_DRAFT
const STATUS_DRAFT
Definition: SPI/Persistence/User/Role.php:17
eZ\Publish\SPI\Persistence\User\Role\STATUS_DEFINED
const STATUS_DEFINED
Definition: SPI/Persistence/User/Role.php:14
eZ\Publish\SPI\Persistence\User\UserTokenUpdateStruct
This update struct is used to update User Tokens (formerly known as User account keys).
Definition: SPI/Persistence/User/UserTokenUpdateStruct.php:15
eZ\Publish\SPI\Persistence\User
Definition: Publish/SPI/Persistence/User.php:10
eZ\Publish\SPI\Persistence\User\Handler
Storage Engine handler for user module.
Definition: SPI/Persistence/User/Handler.php:15
eZ\Publish\Core\Persistence\Cache
Definition: AbstractHandler.php:7
eZ\Publish\SPI\Persistence\User
Definition: SPI/Persistence/User/Handler.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.