vendor/ezsystems/ezplatform-kernel/eZ/Publish/Core/Repository/SiteAccessAware/UserService.php line 30

Open in your IDE?
  1. <?php
  2. /**
  3.  * @copyright Copyright (C) Ibexa AS. All rights reserved.
  4.  * @license For full copyright and license information view LICENSE file distributed with this source code.
  5.  */
  6. declare(strict_types=1);
  7. namespace eZ\Publish\Core\Repository\SiteAccessAware;
  8. use eZ\Publish\API\Repository\UserService as UserServiceInterface;
  9. use eZ\Publish\API\Repository\Values\Content\Content;
  10. use eZ\Publish\API\Repository\Values\ContentType\ContentType;
  11. use eZ\Publish\API\Repository\Values\User\PasswordInfo;
  12. use eZ\Publish\API\Repository\Values\User\PasswordValidationContext;
  13. use eZ\Publish\API\Repository\Values\User\UserGroupCreateStruct;
  14. use eZ\Publish\API\Repository\Values\User\UserGroupUpdateStruct;
  15. use eZ\Publish\API\Repository\Values\User\UserCreateStruct;
  16. use eZ\Publish\API\Repository\Values\User\UserGroup;
  17. use eZ\Publish\API\Repository\Values\User\User;
  18. use eZ\Publish\API\Repository\Values\User\UserTokenUpdateStruct;
  19. use eZ\Publish\API\Repository\Values\User\UserUpdateStruct;
  20. use eZ\Publish\API\Repository\LanguageResolver;
  21. /**
  22.  * UserService for SiteAccessAware layer.
  23.  *
  24.  * Currently does nothing but hand over calls to aggregated service.
  25.  */
  26. class UserService implements UserServiceInterface
  27. {
  28.     /** @var \eZ\Publish\API\Repository\UserService */
  29.     protected $service;
  30.     /** @var \eZ\Publish\API\Repository\LanguageResolver */
  31.     protected $languageResolver;
  32.     /**
  33.      * Construct service object from aggregated service.
  34.      *
  35.      * @param \eZ\Publish\API\Repository\UserService $service
  36.      * @param \eZ\Publish\API\Repository\LanguageResolver $languageResolver
  37.      */
  38.     public function __construct(
  39.         UserServiceInterface $service,
  40.         LanguageResolver $languageResolver
  41.     ) {
  42.         $this->service $service;
  43.         $this->languageResolver $languageResolver;
  44.     }
  45.     public function createUserGroup(UserGroupCreateStruct $userGroupCreateStructUserGroup $parentGroup): UserGroup
  46.     {
  47.         return $this->service->createUserGroup($userGroupCreateStruct$parentGroup);
  48.     }
  49.     public function loadUserGroup(int $id, array $prioritizedLanguages null): UserGroup
  50.     {
  51.         $prioritizedLanguages $this->languageResolver->getPrioritizedLanguages($prioritizedLanguages);
  52.         return $this->service->loadUserGroup($id$prioritizedLanguages);
  53.     }
  54.     public function loadUserGroupByRemoteId(string $remoteId, array $prioritizedLanguages = []): UserGroup
  55.     {
  56.         $prioritizedLanguages $this->languageResolver->getPrioritizedLanguages($prioritizedLanguages);
  57.         return $this->service->loadUserGroupByRemoteId($remoteId$prioritizedLanguages);
  58.     }
  59.     public function loadSubUserGroups(UserGroup $userGroupint $offset 0int $limit 25, array $prioritizedLanguages null): iterable
  60.     {
  61.         $prioritizedLanguages $this->languageResolver->getPrioritizedLanguages($prioritizedLanguages);
  62.         return $this->service->loadSubUserGroups($userGroup$offset$limit$prioritizedLanguages);
  63.     }
  64.     public function deleteUserGroup(UserGroup $userGroup): iterable
  65.     {
  66.         return $this->service->deleteUserGroup($userGroup);
  67.     }
  68.     public function moveUserGroup(UserGroup $userGroupUserGroup $newParent): void
  69.     {
  70.         $this->service->moveUserGroup($userGroup$newParent);
  71.     }
  72.     public function updateUserGroup(UserGroup $userGroupUserGroupUpdateStruct $userGroupUpdateStruct): UserGroup
  73.     {
  74.         return $this->service->updateUserGroup($userGroup$userGroupUpdateStruct);
  75.     }
  76.     public function createUser(UserCreateStruct $userCreateStruct, array $parentGroups): User
  77.     {
  78.         return $this->service->createUser($userCreateStruct$parentGroups);
  79.     }
  80.     public function loadUser(int $userId, array $prioritizedLanguages null): User
  81.     {
  82.         $prioritizedLanguages $this->languageResolver->getPrioritizedLanguages($prioritizedLanguages);
  83.         return $this->service->loadUser($userId$prioritizedLanguages);
  84.     }
  85.     public function checkUserCredentials(User $userstring $credentials): bool
  86.     {
  87.         return $this->service->checkUserCredentials($user$credentials);
  88.     }
  89.     public function loadUserByLogin(string $login, array $prioritizedLanguages null): User
  90.     {
  91.         $prioritizedLanguages $this->languageResolver->getPrioritizedLanguages($prioritizedLanguages);
  92.         return $this->service->loadUserByLogin($login$prioritizedLanguages);
  93.     }
  94.     public function loadUserByEmail(string $email, array $prioritizedLanguages null): User
  95.     {
  96.         $prioritizedLanguages $this->languageResolver->getPrioritizedLanguages($prioritizedLanguages);
  97.         return $this->service->loadUserByEmail($email$prioritizedLanguages);
  98.     }
  99.     public function loadUsersByEmail(string $email, array $prioritizedLanguages null): array
  100.     {
  101.         $prioritizedLanguages $this->languageResolver->getPrioritizedLanguages($prioritizedLanguages);
  102.         return $this->service->loadUsersByEmail($email$prioritizedLanguages);
  103.     }
  104.     public function deleteUser(User $user): iterable
  105.     {
  106.         return $this->service->deleteUser($user);
  107.     }
  108.     public function updateUser(User $userUserUpdateStruct $userUpdateStruct): User
  109.     {
  110.         return $this->service->updateUser($user$userUpdateStruct);
  111.     }
  112.     public function updateUserPassword(User $userstring $newPassword): User
  113.     {
  114.         return $this->service->updateUserPassword($user$newPassword);
  115.     }
  116.     public function assignUserToUserGroup(User $userUserGroup $userGroup): void
  117.     {
  118.         $this->service->assignUserToUserGroup($user$userGroup);
  119.     }
  120.     public function unAssignUserFromUserGroup(User $userUserGroup $userGroup): void
  121.     {
  122.         $this->service->unAssignUserFromUserGroup($user$userGroup);
  123.     }
  124.     public function loadUserGroupsOfUser(User $userint $offset 0int $limit 25, array $prioritizedLanguages null): iterable
  125.     {
  126.         $prioritizedLanguages $this->languageResolver->getPrioritizedLanguages($prioritizedLanguages);
  127.         return $this->service->loadUserGroupsOfUser($user$offset$limit$prioritizedLanguages);
  128.     }
  129.     public function loadUsersOfUserGroup(UserGroup $userGroupint $offset 0int $limit 25, array $prioritizedLanguages null): iterable
  130.     {
  131.         $prioritizedLanguages $this->languageResolver->getPrioritizedLanguages($prioritizedLanguages);
  132.         return $this->service->loadUsersOfUserGroup($userGroup$offset$limit$prioritizedLanguages);
  133.     }
  134.     public function loadUserByToken(string $hash, array $prioritizedLanguages null): User
  135.     {
  136.         return $this->service->loadUserByToken(
  137.             $hash,
  138.             $this->languageResolver->getPrioritizedLanguages($prioritizedLanguages)
  139.         );
  140.     }
  141.     public function updateUserToken(User $userUserTokenUpdateStruct $userTokenUpdateStruct): User
  142.     {
  143.         return $this->service->updateUserToken($user$userTokenUpdateStruct);
  144.     }
  145.     public function expireUserToken(string $hash): void
  146.     {
  147.         $this->service->expireUserToken($hash);
  148.     }
  149.     public function isUser(Content $content): bool
  150.     {
  151.         return $this->service->isUser($content);
  152.     }
  153.     public function isUserGroup(Content $content): bool
  154.     {
  155.         return $this->service->isUserGroup($content);
  156.     }
  157.     public function newUserCreateStruct(string $loginstring $emailstring $passwordstring $mainLanguageCode, ?ContentType $contentType null): UserCreateStruct
  158.     {
  159.         return $this->service->newUserCreateStruct($login$email$password$mainLanguageCode$contentType);
  160.     }
  161.     public function newUserGroupCreateStruct(string $mainLanguageCode, ?ContentType $contentType null): UserGroupCreateStruct
  162.     {
  163.         return $this->service->newUserGroupCreateStruct($mainLanguageCode$contentType);
  164.     }
  165.     public function newUserUpdateStruct(): UserUpdateStruct
  166.     {
  167.         return $this->service->newUserUpdateStruct();
  168.     }
  169.     public function newUserGroupUpdateStruct(): UserGroupUpdateStruct
  170.     {
  171.         return $this->service->newUserGroupUpdateStruct();
  172.     }
  173.     public function validatePassword(string $passwordPasswordValidationContext $context null): array
  174.     {
  175.         return $this->service->validatePassword($password$context);
  176.     }
  177.     public function getPasswordInfo(User $user): PasswordInfo
  178.     {
  179.         return $this->service->getPasswordInfo($user);
  180.     }
  181. }