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

Public Member Functions | Protected Attributes | List of all members
eZ\Publish\Core\SignalSlot\UserService Class Reference

UserService class. More...

Inheritance diagram for eZ\Publish\Core\SignalSlot\UserService:

## Public Member Functions
| __construct (UserServiceInterface $service, SignalDispatcher $signalDispatcher)
| Constructor. More...
| createUserGroup (UserGroupCreateStruct $userGroupCreateStruct, UserGroup $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 (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...
| loadAnonymousUser ()
| Loads anonymous user. More...
| loadUserByCredentials ($login, $password, array $prioritizedLanguages=[])
| Loads a user for the given login and password. More...
| checkUserCredentials (User $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 with user hash key. 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 account key information specified by the user account key struct. More...
| expireUserToken ($hash)
| Expires user token with user hash. 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. Since 7.4 Parameters
  \eZ\Publish\API\Repository\Values\Content\Content | $content |
Returns bool } More...
| isUserGroup (Content $content)
  | {Checks if Content is a user group. Since 7.4 Parameters
  \eZ\Publish\API\Repository\Values\Content\Content | $content |
Returns bool } 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 (User $user)
| Returns information about password for a given user. More...

## Protected Attributes
| $service
| $signalDispatcher

## Detailed Description

UserService class.

Definition at line 34 of file Core/SignalSlot/UserService.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZ\Publish\Core\SignalSlot\UserService::__construct | ( | UserServiceInterface | $service,
|  | SignalDispatcher | $signalDispatcher
| ) |  |

Constructor.

Construct service object from aggregated service and signal dispatcher

Parameters

  \eZ\Publish\API\Repository\UserService | $service |
  \eZ\Publish\Core\SignalSlot\SignalDispatcher | $signalDispatcher |

Definition at line 59 of file Core/SignalSlot/UserService.php.

References eZ\Publish\Core\SignalSlot\UserService\$service, and eZ\Publish\Core\SignalSlot\UserService\$signalDispatcher.

## Member Function Documentation

## ◆ assignUserToUserGroup()

eZ\Publish\Core\SignalSlot\UserService::assignUserToUserGroup | ( | User | $user,
|  | UserGroup | $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

Implements eZ\Publish\API\Repository\UserService.

Definition at line 435 of file Core/SignalSlot/UserService.php.

## ◆ checkUserCredentials()

eZ\Publish\Core\SignalSlot\UserService::checkUserCredentials | ( | User | $user,
|  | string | $credentials
| ) |  |

Checks if credentials are valid for provided User.

Parameters

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

Returns
  bool

Implements eZ\Publish\API\Repository\UserService.

Definition at line 290 of file Core/SignalSlot/UserService.php.

## ◆ createUser()

eZ\Publish\Core\SignalSlot\UserService::createUser | ( | UserCreateStruct | $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
  array | $parentGroups | the groups of type \eZ\Publish\API\Repository\Values\User\UserGroup which are assigned to the user after creation

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

Exceptions

Implements eZ\Publish\API\Repository\UserService.

Definition at line 220 of file Core/SignalSlot/UserService.php.

## ◆ createUserGroup()

eZ\Publish\Core\SignalSlot\UserService::createUserGroup | ( | UserGroupCreateStruct | $userGroupCreateStruct,
|  | UserGroup | $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

Implements eZ\Publish\API\Repository\UserService.

Definition at line 82 of file Core/SignalSlot/UserService.php.

## ◆ deleteUser()

eZ\Publish\Core\SignalSlot\UserService::deleteUser | ( | User | $user | ) |

This method deletes a user.

Parameters

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

Exceptions

Implements eZ\Publish\API\Repository\UserService.

Definition at line 351 of file Core/SignalSlot/UserService.php.

## ◆ deleteUserGroup()

eZ\Publish\Core\SignalSlot\UserService::deleteUserGroup | ( | UserGroup | $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

Implements eZ\Publish\API\Repository\UserService.

Definition at line 138 of file Core/SignalSlot/UserService.php.

## ◆ expireUserToken()

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

Expires user token with user hash.

Parameters

  string | $hash |

Implements eZ\Publish\API\Repository\UserService.

Definition at line 421 of file Core/SignalSlot/UserService.php.

## ◆ getPasswordInfo()

eZ\Publish\Core\SignalSlot\UserService::getPasswordInfo | ( | User | $user | ) |

Returns information about password for a given user.

Parameters

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

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

Implements eZ\Publish\API\Repository\UserService.

Definition at line 590 of file Core/SignalSlot/UserService.php.

## ◆ isUser()

eZ\Publish\Core\SignalSlot\UserService::isUser | ( | Content | $content | ) |

{Checks if Content is a user.

Since
  7.4

Parameters

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

Returns
  bool

}

Implements eZ\Publish\API\Repository\UserService.

Definition at line 520 of file Core/SignalSlot/UserService.php.

## ◆ isUserGroup()

eZ\Publish\Core\SignalSlot\UserService::isUserGroup | ( | Content | $content | ) |

{Checks if Content is a user group.

Since
  7.4

Parameters

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

Returns
  bool

}

Implements eZ\Publish\API\Repository\UserService.

Definition at line 528 of file Core/SignalSlot/UserService.php.

## ◆ loadAnonymousUser()

eZ\Publish\Core\SignalSlot\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 258 of file Core/SignalSlot/UserService.php.

## ◆ loadSubUserGroups()

eZ\Publish\Core\SignalSlot\UserService::loadSubUserGroups | ( | UserGroup | $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

Implements eZ\Publish\API\Repository\UserService.

Definition at line 124 of file Core/SignalSlot/UserService.php.

## ◆ loadUser()

eZ\Publish\Core\SignalSlot\UserService::loadUser | ( |  | $userId,
|  | array | $prioritizedLanguages = `[]`
| ) |  |

Loads a user.

Parameters

  mixed | $userId |
  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 244 of file Core/SignalSlot/UserService.php.

## ◆ loadUserByCredentials()

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

Loads a user for the given login and password.

{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 277 of file Core/SignalSlot/UserService.php.

## ◆ loadUserByLogin()

eZ\Publish\Core\SignalSlot\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 307 of file Core/SignalSlot/UserService.php.

## ◆ loadUserByToken()

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

Loads a user with user hash key.

{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 339 of file Core/SignalSlot/UserService.php.

## ◆ loadUserGroup()

eZ\Publish\Core\SignalSlot\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 107 of file Core/SignalSlot/UserService.php.

## ◆ loadUserGroupsOfUser()

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

Loads the user groups the user belongs to.

Exceptions

Implements eZ\Publish\API\Repository\UserService.

Definition at line 486 of file Core/SignalSlot/UserService.php.

## ◆ loadUsersByEmail()

eZ\Publish\Core\SignalSlot\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 322 of file Core/SignalSlot/UserService.php.

## ◆ loadUsersOfUserGroup()

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

Loads the users of a user group.

Exceptions

Implements eZ\Publish\API\Repository\UserService.

Definition at line 503 of file Core/SignalSlot/UserService.php.

## ◆ moveUserGroup()

eZ\Publish\Core\SignalSlot\UserService::moveUserGroup | ( | UserGroup | $userGroup,
|  | UserGroup | $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

Implements eZ\Publish\API\Repository\UserService.

Definition at line 161 of file Core/SignalSlot/UserService.php.

## ◆ newUserCreateStruct()

eZ\Publish\Core\SignalSlot\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 544 of file Core/SignalSlot/UserService.php.

## ◆ newUserGroupCreateStruct()

eZ\Publish\Core\SignalSlot\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 557 of file Core/SignalSlot/UserService.php.

## ◆ newUserGroupUpdateStruct()

eZ\Publish\Core\SignalSlot\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 577 of file Core/SignalSlot/UserService.php.

## ◆ newUserUpdateStruct()

eZ\Publish\Core\SignalSlot\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 567 of file Core/SignalSlot/UserService.php.

## ◆ unAssignUserFromUserGroup()

eZ\Publish\Core\SignalSlot\UserService::unAssignUserFromUserGroup | ( | User | $user,
|  | UserGroup | $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

Implements eZ\Publish\API\Repository\UserService.

Definition at line 459 of file Core/SignalSlot/UserService.php.

## ◆ updateUser()

eZ\Publish\Core\SignalSlot\UserService::updateUser | ( | User | $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

Implements eZ\Publish\API\Repository\UserService.

Definition at line 382 of file Core/SignalSlot/UserService.php.

## ◆ updateUserGroup()

eZ\Publish\Core\SignalSlot\UserService::updateUserGroup | ( | UserGroup | $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

Implements eZ\Publish\API\Repository\UserService.

Definition at line 192 of file Core/SignalSlot/UserService.php.

## ◆ updateUserToken()

eZ\Publish\Core\SignalSlot\UserService::updateUserToken | ( | User | $user,
|  | UserTokenUpdateStruct | $userTokenUpdateStruct
| ) |  |

Update the user account key information specified by the user account key struct.

Parameters

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

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

Implements eZ\Publish\API\Repository\UserService.

Definition at line 404 of file Core/SignalSlot/UserService.php.

## ◆ validatePassword()

eZ\Publish\Core\SignalSlot\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 585 of file Core/SignalSlot/UserService.php.

## Member Data Documentation

## ◆ $service

eZ\Publish\Core\SignalSlot\UserService::$service
| protected

Definition at line 41 of file Core/SignalSlot/UserService.php.

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

## ◆ $signalDispatcher

eZ\Publish\Core\SignalSlot\UserService::$signalDispatcher
| protected

Definition at line 48 of file Core/SignalSlot/UserService.php.

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

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

- Core/SignalSlot/UserService.php

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