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

Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
eZ\Publish\Core\Repository\UserService Class Reference
Inheritance diagram for eZ\Publish\Core\Repository\UserService:

## Public Member Functions
| setLogger (LoggerInterface $logger=null)
| __construct (RepositoryInterface $repository, Handler $userHandler, LocationHandler $locationHandler, array $settings=[])
| Setups service with reference to repository object that created it & corresponding handler. More...
| createUserGroup (APIUserGroupCreateStruct $userGroupCreateStruct, APIUserGroup $parentGroup)
| Creates a new user group using the data provided in the ContentCreateStruct parameter. More...
| loadUserGroup ($id, array $prioritizedLanguages=[])
| Loads a user group for the given id. More...
| loadSubUserGroups (APIUserGroup $userGroup, $offset=0, $limit=25, array $prioritizedLanguages=[])
| Loads the sub groups of a user group. More...
| deleteUserGroup (APIUserGroup $userGroup)
| Removes a user group. More...
| moveUserGroup (APIUserGroup $userGroup, APIUserGroup $newParent)
| Moves the user group to another parent. More...
| updateUserGroup (APIUserGroup $userGroup, UserGroupUpdateStruct $userGroupUpdateStruct)
| Updates the group profile with fields and meta data. More...
| createUser (APIUserCreateStruct $userCreateStruct, array $parentGroups)
| Create a new user. More...
| loadAnonymousUser ()
| Loads anonymous user. More...
| loadUserByCredentials ($login, $password, array $prioritizedLanguages=[])
| Loads a user for the given login and password. More...
| checkUserCredentials (APIUser $user, string $credentials)
| Checks if credentials are valid for provided User. More...
| loadUserByLogin ($login, array $prioritizedLanguages=[])
| Loads a user for the given login. More...
| loadUsersByEmail ($email, array $prioritizedLanguages=[])
| Loads a user for the given email. More...
| loadUserByToken ($hash, array $prioritizedLanguages=[])
| Loads a user for the given token. More...
| deleteUser (APIUser $user)
| This method deletes a user. More...
| updateUser (APIUser $user, UserUpdateStruct $userUpdateStruct)
| Updates a user. More...
| updateUserToken (APIUser $user, UserTokenUpdateStruct $userTokenUpdateStruct)
| Update the user token information specified by the user token struct. More...
| expireUserToken ($hash)
| Expires user token with user hash. More...
| assignUserToUserGroup (APIUser $user, APIUserGroup $userGroup)
| Assigns a new user group to the user. More...
| unAssignUserFromUserGroup (APIUser $user, APIUserGroup $userGroup)
| Removes a user group from the user. More...
| loadUserGroupsOfUser (APIUser $user, $offset=0, $limit=25, array $prioritizedLanguages=[])
| Loads the user groups the user belongs to. More...
| loadUsersOfUserGroup (APIUserGroup $userGroup, $offset=0, $limit=25, array $prioritizedLanguages=[])
| Loads the users of a user group. More...
| isUser (APIContent $content)
| {} More...
| isUserGroup (APIContent $content)
| {} More...
| newUserCreateStruct ($login, $email, $password, $mainLanguageCode, $contentType=null)
| Instantiate a user create class. More...
| newUserGroupCreateStruct ($mainLanguageCode, $contentType=null)
| Instantiate a user group create class. More...
| newUserUpdateStruct ()
| Instantiate a new user update struct. More...
| newUserGroupUpdateStruct ()
| Instantiate a new user group update struct. More...
| validatePassword (string $password, PasswordValidationContext $context=null)
  | {Validates given password. Parameters
  string | $password |
  \eZ\Publish\API\Repository\Values\User\PasswordValidationContext | null | $context |
  Exceptions
} More...
| getPasswordInfo (APIUser $user)
Public Member Functions inherited from eZ\Publish\API\Repository\UserService
| createUserGroup (UserGroupCreateStruct $userGroupCreateStruct, UserGroup $parentGroup)
| Creates a new user group using the data provided in the ContentCreateStruct parameter. More...
| loadSubUserGroups (UserGroup $userGroup, $offset=0, $limit=25, array $prioritizedLanguages=[])
| Loads the sub groups of a user group. More...
| deleteUserGroup (UserGroup $userGroup)
| Removes a user group. More...
| moveUserGroup (UserGroup $userGroup, UserGroup $newParent)
| Moves the user group to another parent. More...
| updateUserGroup (UserGroup $userGroup, UserGroupUpdateStruct $userGroupUpdateStruct)
| Updates the group profile with fields and meta data. More...
| createUser (UserCreateStruct $userCreateStruct, array $parentGroups)
| Create a new user. More...
| loadUser ($userId, array $prioritizedLanguages=[])
| Loads a user. More...
| checkUserCredentials (User $user, string $credentials)
| Checks if credentials are valid for provided User. More...
| deleteUser (User $user)
| This method deletes a user. More...
| updateUser (User $user, UserUpdateStruct $userUpdateStruct)
| Updates a user. More...
| updateUserToken (User $user, UserTokenUpdateStruct $userTokenUpdateStruct)
| Update the user token information specified by the user token struct. More...
| assignUserToUserGroup (User $user, UserGroup $userGroup)
| Assigns a new user group to the user. More...
| unAssignUserFromUserGroup (User $user, UserGroup $userGroup)
| Removes a user group from the user. More...
| loadUserGroupsOfUser (User $user, $offset=0, $limit=25, array $prioritizedLanguages=[])
| Loads the user groups the user belongs to. More...
| loadUsersOfUserGroup (UserGroup $userGroup, $offset=0, $limit=25, array $prioritizedLanguages=[])
| Loads the users of a user group. More...
| isUser (Content $content)
| Checks if Content is a user. More...
| isUserGroup (Content $content)
| Checks if Content is a user group. More...
| getPasswordInfo (User $user)
| Returns information about password for a given user. More...

## Protected Member Functions
| searchSubGroups (Location $location, $offset=0, $limit=25)
| Returns (searches) subgroups of a user group described by its main location. More...
| buildDomainUserGroupObject (APIContent $content)
| Builds the domain UserGroup object from provided Content object. More...
| buildDomainUserObject (SPIUser $spiUser, APIContent $content=null, array $prioritizedLanguages=[])
| Builds the domain user object from provided persistence user object. More...
| comparePasswordHashForSPIUser (string $login, string $password, SPIUser $spiUser)
| Verifies if the provided login and password are valid for eZ\Publish\SPI\Persistence\User. More...
| comparePasswordHashForAPIUser (string $login, string $password, APIUser $apiUser)
| Verifies if the provided login and password are valid for eZ\Publish\API\Repository\Values\User\User. More...
| verifyPassword ($login, $password, $spiUser)
| Verifies if the provided login and password are valid. More...
| createPasswordHash ($login, $password, $site, $type)
| Returns password hash based on user data and site settings. More...

## Protected Attributes
| $repository
| $userHandler
| $settings
| $logger

## Private Member Functions
| updatePasswordHash ($login, $password, SPIUser $spiUser)
| Update password hash to the type configured for the service, if they differ. More...
| getUserFieldDefinition (ContentType $contentType)
| comparePasswordHashes (string $login, string $plainPassword, string $passwordHash, int $hashAlgorithm)
| Verifies if the provided login and password are valid against given password hash and hash type. More...
| isUserProfileUpdateRequested (UserUpdateStruct $userUpdateStruct)
| Return true if any of the UserUpdateStruct properties refers to User Profile (Content) update. More...
| getDateTime (?int $timestamp)

## Private Attributes
| $locationHandler
| $permissionResolver

## Detailed Description

Definition at line 60 of file Core/Repository/UserService.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZ\Publish\Core\Repository\UserService::__construct | ( | RepositoryInterface | $repository,
|  | Handler | $userHandler,
|  | LocationHandler | $locationHandler,
|  | array | $settings = `[]`
| ) |  |

Setups service with reference to repository object that created it & corresponding handler.

Parameters

  \eZ\Publish\API\Repository\Repository | $repository |
  \eZ\Publish\SPI\Persistence\User\Handler | $userHandler |
  \eZ\Publish\SPI\Persistence\Content\Location\Handler | $locationHandler |
  array | $settings |

Definition at line 93 of file Core/Repository/UserService.php.

References eZ\Publish\Core\Repository\UserService\$locationHandler, eZ\Publish\Core\Repository\UserService\$repository, eZ\Publish\Core\Repository\UserService\$settings, and eZ\Publish\Core\Repository\UserService\$userHandler.

## Member Function Documentation

## ◆ assignUserToUserGroup()

eZ\Publish\Core\Repository\UserService::assignUserToUserGroup | ( | APIUser | $user,
|  | APIUserGroup | $userGroup
| ) |  |

Assigns a new user group to the user.

Parameters

  \eZ\Publish\API\Repository\Values\User\User | $user |
  \eZ\Publish\API\Repository\Values\User\UserGroup | $userGroup |

Exceptions

Definition at line 980 of file Core/Repository/UserService.php.

References eZ\Publish\API\Repository\UserService\loadUser(), and eZ\Publish\Core\Repository\UserService\loadUserGroup().

## ◆ buildDomainUserGroupObject()

eZ\Publish\Core\Repository\UserService::buildDomainUserGroupObject | ( | APIContent | $content | ) |
| protected

Builds the domain UserGroup object from provided Content object.

Parameters

  \eZ\Publish\API\Repository\Values\Content\Content | $content |

Returns
  \eZ\Publish\API\Repository\Values\User\UserGroup

Definition at line 1345 of file Core/Repository/UserService.php.

Referenced by eZ\Publish\Core\Repository\UserService\createUserGroup(), eZ\Publish\Core\Repository\UserService\loadSubUserGroups(), eZ\Publish\Core\Repository\UserService\loadUserGroup(), eZ\Publish\Core\Repository\UserService\loadUserGroupsOfUser(), and eZ\Publish\Core\Repository\UserService\updateUserGroup().

## ◆ buildDomainUserObject()

eZ\Publish\Core\Repository\UserService::buildDomainUserObject | ( | SPIUser | $spiUser,
|  | APIContent | $content = `null`,
|  | array | $prioritizedLanguages = `[]`
| ) |  |
| protected

Builds the domain user object from provided persistence user object.

Parameters

  \eZ\Publish\SPI\Persistence\User | $spiUser |
  \eZ\Publish\API\Repository\Values\Content\Content | null | $content |
  string[] | $prioritizedLanguages | Used as prioritized language code on translated properties of returned object.

Returns
  \eZ\Publish\API\Repository\Values\User\User

Definition at line 1373 of file Core/Repository/UserService.php.

Referenced by eZ\Publish\Core\Repository\UserService\createUser(), eZ\Publish\Core\Repository\UserService\loadUserByCredentials(), eZ\Publish\Core\Repository\UserService\loadUserByLogin(), eZ\Publish\Core\Repository\UserService\loadUserByToken(), eZ\Publish\Core\Repository\UserService\loadUsersByEmail(), and eZ\Publish\Core\Repository\UserService\loadUsersOfUserGroup().

## ◆ checkUserCredentials()

eZ\Publish\Core\Repository\UserService::checkUserCredentials | ( | APIUser | $user,
|  | string | $credentials
| ) |  |

Checks if credentials are valid for provided User.

Parameters

  \eZ\Publish\API\Repository\Values\User\User | $user |
  string | $credentials |

Returns
  bool

Definition at line 630 of file Core/Repository/UserService.php.

References eZ\Publish\Core\Repository\UserService\comparePasswordHashForAPIUser().

## ◆ comparePasswordHashes()

eZ\Publish\Core\Repository\UserService::comparePasswordHashes | ( | string | $login,
|  | string | $plainPassword,
|  | string | $passwordHash,
|  | int | $hashAlgorithm
| ) |  |
| private

Verifies if the provided login and password are valid against given password hash and hash type.

Parameters

  string | $login | User login
  string | $plainPassword | User password
  string | $passwordHash | User password hash
  int | $hashAlgorithm | Hash type

Returns
  bool return true if the login and password are sucessfully validated and false, if not.

Definition at line 1497 of file Core/Repository/UserService.php.

Referenced by eZ\Publish\Core\Repository\UserService\comparePasswordHashForAPIUser(), and eZ\Publish\Core\Repository\UserService\comparePasswordHashForSPIUser().

## ◆ comparePasswordHashForAPIUser()

eZ\Publish\Core\Repository\UserService::comparePasswordHashForAPIUser | ( | string | $login,
|  | string | $password,
|  | APIUser | $apiUser
| ) |  |
| protected

Verifies if the provided login and password are valid for eZ\Publish\API\Repository\Values\User\User.

Parameters

  string | $login | User login
  string | $password | User password
  \eZ\Publish\API\Repository\Values\User\User | $apiUser | Loaded user

Returns
  bool return true if the login and password are sucessfully validated and false, if not.

Definition at line 1465 of file Core/Repository/UserService.php.

References eZ\Publish\Core\Repository\UserService\comparePasswordHashes().

Referenced by eZ\Publish\Core\Repository\UserService\checkUserCredentials(), and eZ\Publish\Core\Repository\UserService\validatePassword().

## ◆ comparePasswordHashForSPIUser()

eZ\Publish\Core\Repository\UserService::comparePasswordHashForSPIUser | ( | string | $login,
|  | string | $password,
|  | SPIUser | $spiUser
| ) |  |
| protected

Verifies if the provided login and password are valid for eZ\Publish\SPI\Persistence\User.

Parameters

  string | $login | User login
  string | $password | User password
  \eZ\Publish\SPI\Persistence\User | $spiUser | Loaded user handler

Returns
  bool return true if the login and password are sucessfully validated and false, if not.

Definition at line 1451 of file Core/Repository/UserService.php.

References eZ\Publish\Core\Repository\UserService\comparePasswordHashes().

Referenced by eZ\Publish\Core\Repository\UserService\loadUserByCredentials(), and eZ\Publish\Core\Repository\UserService\verifyPassword().

## ◆ createPasswordHash()

eZ\Publish\Core\Repository\UserService::createPasswordHash | ( |  | $login,
|  |  | $password,
|  |  | $site,
|  |  | $type
| ) |  |
| protected

Returns password hash based on user data and site settings.

Parameters

  string | $login | User login
  string | $password | User password
  string | $site | The name of the site
  int | $type | Type of password to generate

Returns
  string Generated password hash

Exceptions

Definition at line 1530 of file Core/Repository/UserService.php.

Referenced by eZ\Publish\Core\Repository\UserService\updatePasswordHash(), and eZ\Publish\Core\Repository\UserService\updateUser().

## ◆ createUser()

eZ\Publish\Core\Repository\UserService::createUser | ( | APIUserCreateStruct | $userCreateStruct,
|  | array | $parentGroups
| ) |  |

Create a new user.

The created user is published by this method.

Parameters

  \eZ\Publish\API\Repository\Values\User\UserCreateStruct | $userCreateStruct | the data used for creating the user
  \eZ\Publish\API\Repository\Values\User\UserGroup[] | $parentGroups | the groups which are assigned to the user after creation

Returns
  \eZ\Publish\API\Repository\Values\User\User

Exceptions

Definition at line 391 of file Core/Repository/UserService.php.

References eZ\Publish\Core\Repository\UserService\buildDomainUserObject(), eZ\Publish\Core\Repository\UserService\loadUserGroup(), and eZ\Publish\Core\Repository\UserService\validatePassword().

## ◆ createUserGroup()

eZ\Publish\Core\Repository\UserService::createUserGroup | ( | APIUserGroupCreateStruct | $userGroupCreateStruct,
|  | APIUserGroup | $parentGroup
| ) |  |

Creates a new user group using the data provided in the ContentCreateStruct parameter.

In 4.x in the content type parameter in the profile is ignored

- the content type is determined via configuration and can be set to null. The returned version is published.

Parameters

  \eZ\Publish\API\Repository\Values\User\UserGroupCreateStruct | $userGroupCreateStruct | a structure for setting all necessary data to create this user group
  \eZ\Publish\API\Repository\Values\User\UserGroup | $parentGroup |

Returns
  \eZ\Publish\API\Repository\Values\User\UserGroup

Exceptions

Definition at line 130 of file Core/Repository/UserService.php.

References eZ\Publish\Core\Repository\UserService\buildDomainUserGroupObject(), and eZ\Publish\Core\Repository\UserService\loadUserGroup().

## ◆ deleteUser()

eZ\Publish\Core\Repository\UserService::deleteUser | ( | APIUser | $user | ) |

This method deletes a user.

Parameters

  \eZ\Publish\API\Repository\Values\User\User | $user |

Exceptions

Definition at line 751 of file Core/Repository/UserService.php.

References eZ\Publish\API\Repository\UserService\loadUser().

## ◆ deleteUserGroup()

eZ\Publish\Core\Repository\UserService::deleteUserGroup | ( | APIUserGroup | $userGroup | ) |

Removes a user group.

the users which are not assigned to other groups will be deleted.

Parameters

  \eZ\Publish\API\Repository\Values\User\UserGroup | $userGroup |

Exceptions

Definition at line 264 of file Core/Repository/UserService.php.

References eZ\Publish\Core\Repository\UserService\loadUserGroup().

## ◆ expireUserToken()

eZ\Publish\Core\Repository\UserService::expireUserToken | ( |  | $hash | ) |

Expires user token with user hash.

Parameters

  string | $hash |

Implements eZ\Publish\API\Repository\UserService.

Definition at line 959 of file Core/Repository/UserService.php.

## ◆ getDateTime()

eZ\Publish\Core\Repository\UserService::getDateTime | ( | ?int | $timestamp | ) |
| private

Definition at line 1583 of file Core/Repository/UserService.php.

## ◆ getPasswordInfo()

eZ\Publish\Core\Repository\UserService::getPasswordInfo | ( | APIUser | $user | ) |

Definition at line 1399 of file Core/Repository/UserService.php.

References eZ\Publish\Core\Repository\UserService\getUserFieldDefinition().

Referenced by eZ\Publish\Core\Repository\UserService\validatePassword().

## ◆ getUserFieldDefinition()

eZ\Publish\Core\Repository\UserService::getUserFieldDefinition | ( | ContentType | $contentType | ) |
| private

Definition at line 1431 of file Core/Repository/UserService.php.

References eZ\Publish\API\Repository\Values\ContentType\ContentType\getFieldDefinitions().

Referenced by eZ\Publish\Core\Repository\UserService\getPasswordInfo().

## ◆ isUser()

eZ\Publish\Core\Repository\UserService::isUser | ( | APIContent | $content | ) |

{}

Definition at line 1186 of file Core/Repository/UserService.php.

## ◆ isUserGroup()

eZ\Publish\Core\Repository\UserService::isUserGroup | ( | APIContent | $content | ) |

{}

Definition at line 1207 of file Core/Repository/UserService.php.

## ◆ isUserProfileUpdateRequested()

eZ\Publish\Core\Repository\UserService::isUserProfileUpdateRequested | ( | UserUpdateStruct | $userUpdateStruct | ) |
| private

Return true if any of the UserUpdateStruct properties refers to User Profile (Content) update.

Parameters

  UserUpdateStruct | $userUpdateStruct |

Returns
  bool

Definition at line 1573 of file Core/Repository/UserService.php.

Referenced by eZ\Publish\Core\Repository\UserService\updateUser().

## ◆ loadAnonymousUser()

eZ\Publish\Core\Repository\UserService::loadAnonymousUser | ( |  | ) |

Loads anonymous user.

Deprecated:
  since 5.3, use loadUser( $anonymousUserId ) instead

@uses ::loadUser()

Returns
  \eZ\Publish\API\Repository\Values\User\User

Implements eZ\Publish\API\Repository\UserService.

Definition at line 575 of file Core/Repository/UserService.php.

References eZ\Publish\API\Repository\UserService\loadUser().

## ◆ loadSubUserGroups()

eZ\Publish\Core\Repository\UserService::loadSubUserGroups | ( | APIUserGroup | $userGroup,
|  |  | $offset = `0`,
|  |  | $limit = `25`,
|  | array | $prioritizedLanguages = `[]`
| ) |  |

Loads the sub groups of a user group.

Parameters

  \eZ\Publish\API\Repository\Values\User\UserGroup | $userGroup |
  int | $offset | the start offset for paging
  int | $limit | the number of user groups returned
  string[] | $prioritizedLanguages | Used as prioritized language code on translated properties of returned object.

Returns
  \eZ\Publish\API\Repository\Values\User\UserGroup[]

Exceptions

Definition at line 194 of file Core/Repository/UserService.php.

References eZ\Publish\Core\Repository\UserService\buildDomainUserGroupObject(), eZ\Publish\Core\Repository\UserService\loadUserGroup(), and eZ\Publish\Core\Repository\UserService\searchSubGroups().

## ◆ loadUserByCredentials()

eZ\Publish\Core\Repository\UserService::loadUserByCredentials | ( |  | $login,
|  |  | $password,
|  | array | $prioritizedLanguages = `[]`
| ) |  |

Loads a user for the given login and password.

If the password hash type differs from that configured for the service, it will be updated to the configured one.

{Loads a user for the given login and password.Since 6.1 login is case-insensitive across all storage engines and database backends, however if login is part of the password hash this method will essentially be case sensitive.

Deprecated:
  since eZ Platform 2.5, will be dropped in the next major version as authentication may depend on various user providers. Use UserService::checkUserCredentials() instead.

Parameters

  string | $login |
  string | $password | the plain password
  string[] | $prioritizedLanguages | Used as prioritized language code on translated properties of returned object.

Returns
  \eZ\Publish\API\Repository\Values\User\User

Exceptions

}

Parameters

  string | $login |
  string | $password | the plain password
  string[] | $prioritizedLanguages | Used as prioritized language code on translated properties of returned object.

Returns
  \eZ\Publish\API\Repository\Values\User\User

Exceptions

Implements eZ\Publish\API\Repository\UserService.

Definition at line 596 of file Core/Repository/UserService.php.

References eZ\Publish\Core\Repository\UserService\buildDomainUserObject(), eZ\Publish\Core\Repository\UserService\comparePasswordHashForSPIUser(), and eZ\Publish\Core\Repository\UserService\updatePasswordHash().

## ◆ loadUserByLogin()

eZ\Publish\Core\Repository\UserService::loadUserByLogin | ( |  | $login,
|  | array | $prioritizedLanguages = `[]`
| ) |  |

Loads a user for the given login.

{Loads a user for the given login.Since 6.1 login is case-insensitive across all storage engines and database backends, like was the case with mysql before in eZ Publish 3.x/4.x/5.x.

Parameters

  string | $login |
  string[] | $prioritizedLanguages | Used as prioritized language code on translated properties of returned object.

Returns
  \eZ\Publish\API\Repository\Values\User\User

Exceptions

}

Parameters

  string | $login |
  string[] | $prioritizedLanguages | Used as prioritized language code on translated properties of returned object.

Returns
  \eZ\Publish\API\Repository\Values\User\User

Exceptions

Implements eZ\Publish\API\Repository\UserService.

Definition at line 685 of file Core/Repository/UserService.php.

References eZ\Publish\Core\Repository\UserService\buildDomainUserObject().

## ◆ loadUserByToken()

eZ\Publish\Core\Repository\UserService::loadUserByToken | ( |  | $hash,
|  | array | $prioritizedLanguages = `[]`
| ) |  |

Loads a user for the given token.

{Loads a user with user hash key.

Parameters

  string | $hash |
  array | $prioritizedLanguages |

Returns
  \eZ\Publish\API\Repository\Values\User\User

}

Parameters

  string | $hash |
  string[] | $prioritizedLanguages | Used as prioritized language code on translated properties of returned object.

Returns
  \eZ\Publish\API\Repository\Values\User\User

Exceptions

Implements eZ\Publish\API\Repository\UserService.

Definition at line 733 of file Core/Repository/UserService.php.

References eZ\Publish\Core\Repository\UserService\buildDomainUserObject().

## ◆ loadUserGroup()

eZ\Publish\Core\Repository\UserService::loadUserGroup | ( |  | $id,
|  | array | $prioritizedLanguages = `[]`
| ) |  |

Loads a user group for the given id.

Parameters

  mixed | $id |
  string[] | $prioritizedLanguages | Used as prioritized language code on translated properties of returned object.

Returns
  \eZ\Publish\API\Repository\Values\User\UserGroup

Exceptions

Implements eZ\Publish\API\Repository\UserService.

Definition at line 175 of file Core/Repository/UserService.php.

References eZ\Publish\Core\Repository\UserService\buildDomainUserGroupObject().

Referenced by eZ\Publish\Core\Repository\UserService\assignUserToUserGroup(), eZ\Publish\Core\Repository\UserService\createUser(), eZ\Publish\Core\Repository\UserService\createUserGroup(), eZ\Publish\Core\Repository\UserService\deleteUserGroup(), eZ\Publish\Core\Repository\UserService\loadSubUserGroups(), eZ\Publish\Core\Repository\UserService\loadUsersOfUserGroup(), eZ\Publish\Core\Repository\UserService\moveUserGroup(), eZ\Publish\Core\Repository\UserService\unAssignUserFromUserGroup(), and eZ\Publish\Core\Repository\UserService\updateUserGroup().

## ◆ loadUserGroupsOfUser()

eZ\Publish\Core\Repository\UserService::loadUserGroupsOfUser | ( | APIUser | $user,
|  |  | $offset = `0`,
|  |  | $limit = `25`,
|  | array | $prioritizedLanguages = `[]`
| ) |  |

Loads the user groups the user belongs to.

Exceptions

Definition at line 1078 of file Core/Repository/UserService.php.

References eZ\Publish\Core\Repository\UserService\buildDomainUserGroupObject().

## ◆ loadUsersByEmail()

eZ\Publish\Core\Repository\UserService::loadUsersByEmail | ( |  | $email,
|  | array | $prioritizedLanguages = `[]`
| ) |  |

Loads a user for the given email.

{Loads a user for the given email.Note: This method loads user by $email where $email might be case-insensitive on certain storage engines!Returns an array of Users since eZ Publish has under certain circumstances allowed several users having same email in the past (by means of a configuration option).

Parameters

  string | $email |
  string[] | $prioritizedLanguages | Used as prioritized language code on translated properties of returned object.

Returns
  \eZ\Publish\API\Repository\Values\User\User[]

}

Parameters

  string | $email |
  string[] | $prioritizedLanguages | Used as prioritized language code on translated properties of returned object.

Returns
  \eZ\Publish\API\Repository\Values\User\User[]

Implements eZ\Publish\API\Repository\UserService.

Definition at line 706 of file Core/Repository/UserService.php.

References eZ\Publish\Core\Repository\UserService\buildDomainUserObject().

## ◆ loadUsersOfUserGroup()

eZ\Publish\Core\Repository\UserService::loadUsersOfUserGroup | ( | APIUserGroup | $userGroup,
|  |  | $offset = `0`,
|  |  | $limit = `25`,
|  | array | $prioritizedLanguages = `[]`
| ) |  |

Loads the users of a user group.

Exceptions

Definition at line 1137 of file Core/Repository/UserService.php.

References eZ\Publish\Core\Repository\UserService\buildDomainUserObject(), and eZ\Publish\Core\Repository\UserService\loadUserGroup().

## ◆ moveUserGroup()

eZ\Publish\Core\Repository\UserService::moveUserGroup | ( | APIUserGroup | $userGroup,
|  | APIUserGroup | $newParent
| ) |  |

Moves the user group to another parent.

Parameters

  \eZ\Publish\API\Repository\Values\User\UserGroup | $userGroup |
  \eZ\Publish\API\Repository\Values\User\UserGroup | $newParent |

Exceptions

Definition at line 289 of file Core/Repository/UserService.php.

References eZ\Publish\Core\Repository\UserService\loadUserGroup().

## ◆ newUserCreateStruct()

eZ\Publish\Core\Repository\UserService::newUserCreateStruct | ( |  | $login,
|  |  | $email,
|  |  | $password,
|  |  | $mainLanguageCode,
|  |  | $contentType = `null`
| ) |  |

Instantiate a user create class.

Parameters

  string | $login | the login of the new user
  string | $email | the email of the new user
  string | $password | the plain password of the new user
  string | $mainLanguageCode | the main language for the underlying content object
  \eZ\Publish\API\Repository\Values\ContentType\ContentType | $contentType | 5.x the content type for the underlying content object. In 4.x it is ignored and taken from the configuration

Returns
  \eZ\Publish\API\Repository\Values\User\UserCreateStruct

Implements eZ\Publish\API\Repository\UserService.

Definition at line 1223 of file Core/Repository/UserService.php.

## ◆ newUserGroupCreateStruct()

eZ\Publish\Core\Repository\UserService::newUserGroupCreateStruct | ( |  | $mainLanguageCode,
|  |  | $contentType = `null`
| ) |  |

Instantiate a user group create class.

Parameters

  string | $mainLanguageCode | The main language for the underlying content object
  \eZ\Publish\API\Repository\Values\ContentType\ContentType | null | $contentType | 5.x the content type for the underlying content object. In 4.x it is ignored and taken from the configuration

Returns
  \eZ\Publish\API\Repository\Values\User\UserGroupCreateStruct

Implements eZ\Publish\API\Repository\UserService.

Definition at line 1252 of file Core/Repository/UserService.php.

## ◆ newUserGroupUpdateStruct()

eZ\Publish\Core\Repository\UserService::newUserGroupUpdateStruct | ( |  | ) |

Instantiate a new user group update struct.

Returns
  \eZ\Publish\API\Repository\Values\User\UserGroupUpdateStruct

Implements eZ\Publish\API\Repository\UserService.

Definition at line 1284 of file Core/Repository/UserService.php.

## ◆ newUserUpdateStruct()

eZ\Publish\Core\Repository\UserService::newUserUpdateStruct | ( |  | ) |

Instantiate a new user update struct.

Returns
  \eZ\Publish\API\Repository\Values\User\UserUpdateStruct

Implements eZ\Publish\API\Repository\UserService.

Definition at line 1274 of file Core/Repository/UserService.php.

## ◆ searchSubGroups()

eZ\Publish\Core\Repository\UserService::searchSubGroups | ( | Location | $location,
|  |  | $offset = `0`,
|  |  | $limit = `25`
| ) |  |
| protected

Returns (searches) subgroups of a user group described by its main location.

Parameters

  \eZ\Publish\API\Repository\Values\Content\Location | $location |
  int | $offset |
  int | $limit |

Returns
  \eZ\Publish\API\Repository\Values\Content\Search\SearchResult

Definition at line 238 of file Core/Repository/UserService.php.

References eZ\Publish\API\Repository\Values\Content\Location\getSortClauses().

Referenced by eZ\Publish\Core\Repository\UserService\loadSubUserGroups().

## ◆ setLogger()

eZ\Publish\Core\Repository\UserService::setLogger | ( | LoggerInterface | $logger = `null` | ) |

Definition at line 80 of file Core/Repository/UserService.php.

References eZ\Publish\Core\Repository\UserService\$logger.

## ◆ unAssignUserFromUserGroup()

eZ\Publish\Core\Repository\UserService::unAssignUserFromUserGroup | ( | APIUser | $user,
|  | APIUserGroup | $userGroup
| ) |  |

Removes a user group from the user.

Parameters

  \eZ\Publish\API\Repository\Values\User\User | $user |
  \eZ\Publish\API\Repository\Values\User\UserGroup | $userGroup |

Exceptions

Definition at line 1028 of file Core/Repository/UserService.php.

References eZ\Publish\API\Repository\UserService\loadUser(), and eZ\Publish\Core\Repository\UserService\loadUserGroup().

## ◆ updatePasswordHash()

eZ\Publish\Core\Repository\UserService::updatePasswordHash | ( |  | $login,
|  |  | $password,
|  | SPIUser | $spiUser
| ) |  |
| private

Update password hash to the type configured for the service, if they differ.

Parameters

  string | $login | User login
  string | $password | User password
  \eZ\Publish\SPI\Persistence\User | $spiUser |

Exceptions

Definition at line 644 of file Core/Repository/UserService.php.

References eZ\Publish\Core\Repository\UserService\createPasswordHash().

Referenced by eZ\Publish\Core\Repository\UserService\loadUserByCredentials().

## ◆ updateUser()

eZ\Publish\Core\Repository\UserService::updateUser | ( | APIUser | $user,
|  | UserUpdateStruct | $userUpdateStruct
| ) |  |

Updates a user.

4.x: If the versionUpdateStruct is set in the user update structure, this method internally creates a content draft, updates ts with the provided data and publishes the draft. If a draft is explicitly required, the user group can be updated via the content service methods.

Parameters

  \eZ\Publish\API\Repository\Values\User\User | $user |
  \eZ\Publish\API\Repository\Values\User\UserUpdateStruct | $userUpdateStruct |

Exceptions

Definition at line 783 of file Core/Repository/UserService.php.

References eZ\Publish\Core\Repository\UserService\createPasswordHash(), eZ\Publish\Core\Repository\UserService\isUserProfileUpdateRequested(), eZ\Publish\API\Repository\UserService\loadUser(), and eZ\Publish\Core\Repository\UserService\validatePassword().

## ◆ updateUserGroup()

eZ\Publish\Core\Repository\UserService::updateUserGroup | ( | APIUserGroup | $userGroup,
|  | UserGroupUpdateStruct | $userGroupUpdateStruct
| ) |  |

Updates the group profile with fields and meta data.

4.x: If the versionUpdateStruct is set in $userGroupUpdateStruct, this method internally creates a content draft, updates ts with the provided data and publishes the draft. If a draft is explicitly required, the user group can be updated via the content service methods.

Parameters

  \eZ\Publish\API\Repository\Values\User\UserGroup | $userGroup |
  \eZ\Publish\API\Repository\Values\User\UserGroupUpdateStruct | $userGroupUpdateStruct |

Returns
  \eZ\Publish\API\Repository\Values\User\UserGroup

Exceptions

Definition at line 336 of file Core/Repository/UserService.php.

References eZ\Publish\Core\Repository\UserService\buildDomainUserGroupObject(), and eZ\Publish\Core\Repository\UserService\loadUserGroup().

## ◆ updateUserToken()

eZ\Publish\Core\Repository\UserService::updateUserToken | ( | APIUser | $user,
|  | UserTokenUpdateStruct | $userTokenUpdateStruct
| ) |  |

Update the user token information specified by the user token struct.

Parameters

  \eZ\Publish\API\Repository\Values\User\User | $user |
  \eZ\Publish\API\Repository\Values\User\UserTokenUpdateStruct | $userTokenUpdateStruct |

Exceptions

Definition at line 922 of file Core/Repository/UserService.php.

References eZ\Publish\API\Repository\UserService\loadUser().

## ◆ validatePassword()

eZ\Publish\Core\Repository\UserService::validatePassword | ( | string | $password,
|  | PasswordValidationContext | $context = `null`
| ) |  |

{Validates given password.

Parameters

  string | $password |
  \eZ\Publish\API\Repository\Values\User\PasswordValidationContext | null | $context |

Exceptions

}

Implements eZ\Publish\API\Repository\UserService.

Definition at line 1292 of file Core/Repository/UserService.php.

References eZ\Publish\Core\Repository\UserService\comparePasswordHashForAPIUser(), and eZ\Publish\Core\Repository\UserService\getPasswordInfo().

Referenced by eZ\Publish\Core\Repository\UserService\createUser(), and eZ\Publish\Core\Repository\UserService\updateUser().

## ◆ verifyPassword()

eZ\Publish\Core\Repository\UserService::verifyPassword | ( |  | $login,
|  |  | $password,
|  |  | $spiUser
| ) |  |
| protected

Verifies if the provided login and password are valid.

Deprecated:
  since v7.5.5 in favour of verifyPasswordForSPIUser

Parameters

  string | $login | User login
  string | $password | User password
  \eZ\Publish\SPI\Persistence\User | $spiUser | Loaded user handler

Returns
  bool return true if the login and password are sucessfully validate and false, if not.

Definition at line 1482 of file Core/Repository/UserService.php.

References eZ\Publish\Core\Repository\UserService\comparePasswordHashForSPIUser().

## Member Data Documentation

## ◆ $locationHandler

eZ\Publish\Core\Repository\UserService::$locationHandler
| private

Definition at line 69 of file Core/Repository/UserService.php.

Referenced by eZ\Publish\Core\Repository\UserService\__construct().

## ◆ $logger

eZ\Publish\Core\Repository\UserService::$logger
| protected

Definition at line 75 of file Core/Repository/UserService.php.

Referenced by eZ\Publish\Core\Repository\UserService\setLogger().

## ◆ $permissionResolver

eZ\Publish\Core\Repository\UserService::$permissionResolver
| private

Definition at line 78 of file Core/Repository/UserService.php.

## ◆ $repository

eZ\Publish\Core\Repository\UserService::$repository
| protected

Definition at line 63 of file Core/Repository/UserService.php.

Referenced by eZ\Publish\Core\Repository\UserService\__construct().

## ◆ $settings

eZ\Publish\Core\Repository\UserService::$settings
| protected

Definition at line 72 of file Core/Repository/UserService.php.

Referenced by eZ\Publish\Core\Repository\UserService\__construct().

## ◆ $userHandler

eZ\Publish\Core\Repository\UserService::$userHandler
| protected

Definition at line 66 of file Core/Repository/UserService.php.

Referenced by eZ\Publish\Core\Repository\UserService\__construct().

The documentation for this class was generated from the following file:

- Core/Repository/UserService.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.