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

Public Member Functions | List of all members
eZ\Publish\SPI\Persistence\User\Handler Interface Reference

Storage Engine handler for user module. More...

Inheritance diagram for eZ\Publish\SPI\Persistence\User\Handler:

## Public Member Functions
| create (User $user)
| Create a user. More...
| load ($userId)
| Loads user with user ID. More...
| loadByLogin ($login)
| Loads user with user login. More...
| loadByEmail ($email)
| Loads user(s) with user email. More...
| loadUserByToken ($hash)
| Loads user with user hash. More...
| update (User $user)
| Update the user information specified by the user struct. More...
| updateUserToken (UserTokenUpdateStruct $userTokenUpdateStruct)
| Update the user information specified by the user token struct. More...
| expireUserToken ($hash)
| Expires user token with user hash. More...
| delete ($userId)
| Delete user with the given ID. More...
| createRole (RoleCreateStruct $createStruct)
| Create new role. More...
| createRoleDraft ($roleId)
| Creates a draft of existing defined role. More...
| loadRole ($roleId, $status=Role::STATUS_DEFINED)
| Loads a specified role (draft) by $roleId. More...
| loadRoleByIdentifier ($identifier, $status=Role::STATUS_DEFINED)
| Loads a specified role (draft) by $identifier. More...
| loadRoleDraftByRoleId ($roleId)
| Loads a role draft by the original role ID. More...
| loadRoles ()
| Loads all roles. More...
| loadRoleAssignment ($roleAssignmentId)
| Loads role assignment for specified assignment ID. More...
| loadRoleAssignmentsByRoleId ($roleId)
| Loads roles assignments Role. More...
| loadRoleAssignmentsByGroupId ($groupId, $inherit=false)
| Loads roles assignments to a user/group. More...
| updateRole (RoleUpdateStruct $role)
| Update role (draft). More...
| deleteRole ($roleId, $status=Role::STATUS_DEFINED)
| Delete the specified role (draft). More...
| publishRoleDraft ($roleDraftId)
| Publish the specified role draft. More...
| addPolicyByRoleDraft ($roleId, Policy $policy)
| Adds a policy to a role draft. More...
| addPolicy ($roleId, Policy $policy)
| Adds a policy to a role. More...
| updatePolicy (Policy $policy)
| Update a policy. More...
| deletePolicy ($policyId, $roleId)
| Removes a policy from a role. More...
| loadPoliciesByUserId ($userId)
| Returns the user policies associated with the user (including inherited policies from user groups). More...
| assignRole ($contentId, $roleId, array $limitation=null)
| Assigns role to a user or user group with given limitations. More...
| unassignRole ($contentId, $roleId)
| Un-assign a role. More...
| removeRoleAssignment ($roleAssignmentId)
| Un-assign a role, by assignment ID. More...

## Detailed Description

Storage Engine handler for user module.

Definition at line 14 of file SPI/Persistence/User/Handler.php.

## Member Function Documentation

## ◆ addPolicy()

eZ\Publish\SPI\Persistence\User\Handler::addPolicy | ( |  | $roleId,
|  | Policy | $policy
| ) |  |

Adds a policy to a role.

Parameters

  mixed | $roleId |
  \eZ\Publish\SPI\Persistence\User\Policy | $policy |

Returns
  \eZ\Publish\SPI\Persistence\User\Policy

Todo:
  Throw on invalid Role Id?

Exceptions

Implemented in eZ\Publish\Core\Persistence\Legacy\User\Handler, and eZ\Publish\Core\Persistence\Cache\UserHandler.

## ◆ addPolicyByRoleDraft()

eZ\Publish\SPI\Persistence\User\Handler::addPolicyByRoleDraft | ( |  | $roleId,
|  | Policy | $policy
| ) |  |

Adds a policy to a role draft.

Parameters

  mixed | $roleId |
  \eZ\Publish\SPI\Persistence\User\Policy | $policy |

Returns
  \eZ\Publish\SPI\Persistence\User\Policy

Todo:
  Throw on invalid Role Id?

Exceptions

Implemented in eZ\Publish\Core\Persistence\Legacy\User\Handler, and eZ\Publish\Core\Persistence\Cache\UserHandler.

## ◆ assignRole()

eZ\Publish\SPI\Persistence\User\Handler::assignRole | ( |  | $contentId,
|  |  | $roleId,
|  | array | $limitation = `null`
| ) |  |

Assigns role to a user or user group with given limitations.

The limitation array looks like: `array( 'Subtree' => array( '/1/2/', '/1/4/', ), 'Foo' => array( 'Bar' ), … )`

Where the keys are the limitation identifiers, and the respective values are an array of limitation values. The limitation parameter is optional.

Parameters

  mixed | $contentId | The groupId or userId to assign the role to.
  mixed | $roleId |
  array | $limitation |

Implemented in eZ\Publish\Core\Persistence\Legacy\User\Handler, and eZ\Publish\Core\Persistence\Cache\UserHandler.

## ◆ create()

eZ\Publish\SPI\Persistence\User\Handler::create | ( | User | $user | ) |

Create a user.

The User struct used to create the user will contain an ID which is used to reference the user.

Parameters

  \eZ\Publish\SPI\Persistence\User | $user |

Returns
  \eZ\Publish\SPI\Persistence\User

Implemented in eZ\Publish\Core\Persistence\Legacy\User\Handler, and eZ\Publish\Core\Persistence\Cache\UserHandler.

## ◆ createRole()

eZ\Publish\SPI\Persistence\User\Handler::createRole | ( | RoleCreateStruct | $createStruct | ) |

Create new role.

Parameters

  \eZ\Publish\SPI\Persistence\User\RoleCreateStruct | $createStruct |

Returns
  \eZ\Publish\SPI\Persistence\User\Role

Implemented in eZ\Publish\Core\Persistence\Legacy\User\Handler, and eZ\Publish\Core\Persistence\Cache\UserHandler.

## ◆ createRoleDraft()

eZ\Publish\SPI\Persistence\User\Handler::createRoleDraft | ( |  | $roleId | ) |

Creates a draft of existing defined role.

Sets status to Role::STATUS_DRAFT on the new returned draft.

Parameters

  mixed | $roleId |

Exceptions

Implemented in eZ\Publish\Core\Persistence\Legacy\User\Handler, and eZ\Publish\Core\Persistence\Cache\UserHandler.

## ◆ delete()

eZ\Publish\SPI\Persistence\User\Handler::delete | ( |  | $userId | ) |

Delete user with the given ID.

Parameters

  mixed | $userId |

Todo:
  Throw on missing user?

Implemented in eZ\Publish\Core\Persistence\Legacy\User\Handler, and eZ\Publish\Core\Persistence\Cache\UserHandler.

## ◆ deletePolicy()

eZ\Publish\SPI\Persistence\User\Handler::deletePolicy | ( |  | $policyId,
|  |  | $roleId
| ) |  |

Removes a policy from a role.

Parameters

  mixed | $policyId |
  mixed | $roleId |

Todo:
  Throw exception on missing role / policy?

Implemented in eZ\Publish\Core\Persistence\Legacy\User\Handler, and eZ\Publish\Core\Persistence\Cache\UserHandler.

## ◆ deleteRole()

eZ\Publish\SPI\Persistence\User\Handler::deleteRole | ( |  | $roleId,
|  |  | $status = `Role::STATUS_DEFINED`
| ) |  |

Delete the specified role (draft).

Parameters

  mixed | $roleId |
  int | $status | One of Role::STATUS_DEFINED|Role::STATUS_DRAFT

Implemented in eZ\Publish\Core\Persistence\Legacy\User\Handler, and eZ\Publish\Core\Persistence\Cache\UserHandler.

## ◆ expireUserToken()

eZ\Publish\SPI\Persistence\User\Handler::expireUserToken | ( |  | $hash | ) |

Expires user token with user hash.

Parameters

  string | $hash |

Implemented in eZ\Publish\Core\Persistence\Legacy\User\Handler, and eZ\Publish\Core\Persistence\Cache\UserHandler.

## ◆ load()

eZ\Publish\SPI\Persistence\User\Handler::load | ( |  | $userId | ) |

Loads user with user ID.

Parameters

  mixed | $userId |

Exceptions

Implemented in eZ\Publish\Core\Persistence\Legacy\User\Handler, and eZ\Publish\Core\Persistence\Cache\UserHandler.

## ◆ loadByEmail()

eZ\Publish\SPI\Persistence\User\Handler::loadByEmail | ( |  | $email | ) |

Loads user(s) with user email.

As earlier eZ Publish versions supported several users having same email (ini config), this function may return several users.

Note: This method loads user by $email case in-sensitive on certain storage engines!

Parameters

  string | $email |

Returns
  \eZ\Publish\SPI\Persistence\User[]

Implemented in eZ\Publish\Core\Persistence\Legacy\User\Handler, and eZ\Publish\Core\Persistence\Cache\UserHandler.

## ◆ loadByLogin()

eZ\Publish\SPI\Persistence\User\Handler::loadByLogin | ( |  | $login | ) |

Loads user with user login.

Note: This method loads user by $login case in-sensitive on certain storage engines!

Parameters

  string | $login |

Exceptions

Implemented in eZ\Publish\Core\Persistence\Legacy\User\Handler, and eZ\Publish\Core\Persistence\Cache\UserHandler.

## ◆ loadPoliciesByUserId()

eZ\Publish\SPI\Persistence\User\Handler::loadPoliciesByUserId | ( |  | $userId | ) |

Returns the user policies associated with the user (including inherited policies from user groups).

Deprecated:
  Since 6.8, not currently in use as permission system needs to know about role assignment limitations.

Parameters

  mixed | $userId | In legacy storage engine this is the content object id roles are assigned to in ezuser_role.

Returns
  \eZ\Publish\SPI\Persistence\User\Policy[]

Implemented in eZ\Publish\Core\Persistence\Legacy\User\Handler, and eZ\Publish\Core\Persistence\Cache\UserHandler.

## ◆ loadRole()

eZ\Publish\SPI\Persistence\User\Handler::loadRole | ( |  | $roleId,
|  |  | $status = `Role::STATUS_DEFINED`
| ) |  |

Loads a specified role (draft) by $roleId.

Parameters

  mixed | $roleId |
  int | $status | One of Role::STATUS_DEFINED|Role::STATUS_DRAFT

Exceptions

Implemented in eZ\Publish\Core\Persistence\Legacy\User\Handler, and eZ\Publish\Core\Persistence\Cache\UserHandler.

## ◆ loadRoleAssignment()

eZ\Publish\SPI\Persistence\User\Handler::loadRoleAssignment | ( |  | $roleAssignmentId | ) |

Loads role assignment for specified assignment ID.

Parameters

  mixed | $roleAssignmentId |

Exceptions

Implemented in eZ\Publish\Core\Persistence\Legacy\User\Handler, and eZ\Publish\Core\Persistence\Cache\UserHandler.

## ◆ loadRoleAssignmentsByGroupId()

eZ\Publish\SPI\Persistence\User\Handler::loadRoleAssignmentsByGroupId | ( |  | $groupId,
|  |  | $inherit = `false`
| ) |  |

Loads roles assignments to a user/group.

Role Assignments with same roleId and limitationIdentifier will be merged together into one.

Parameters

  mixed | $groupId | In legacy storage engine this is the content object id roles are assigned to in ezuser_role. By the nature of legacy this can currently also be used to get by $userId.
  bool | $inherit | If true also return inherited role assignments from user groups.

Returns
  \eZ\Publish\SPI\Persistence\User\RoleAssignment[]

Implemented in eZ\Publish\Core\Persistence\Legacy\User\Handler, and eZ\Publish\Core\Persistence\Cache\UserHandler.

## ◆ loadRoleAssignmentsByRoleId()

eZ\Publish\SPI\Persistence\User\Handler::loadRoleAssignmentsByRoleId | ( |  | $roleId | ) |

Loads roles assignments Role.

Role Assignments with same roleId and limitationIdentifier will be merged together into one.

Parameters

  mixed | $roleId |

Returns
  \eZ\Publish\SPI\Persistence\User\RoleAssignment[]

Implemented in eZ\Publish\Core\Persistence\Legacy\User\Handler, and eZ\Publish\Core\Persistence\Cache\UserHandler.

## ◆ loadRoleByIdentifier()

eZ\Publish\SPI\Persistence\User\Handler::loadRoleByIdentifier | ( |  | $identifier,
|  |  | $status = `Role::STATUS_DEFINED`
| ) |  |

Loads a specified role (draft) by $identifier.

Parameters

  string | $identifier |
  int | $status | One of Role::STATUS_DEFINED|Role::STATUS_DRAFT

Exceptions

Implemented in eZ\Publish\Core\Persistence\Legacy\User\Handler, and eZ\Publish\Core\Persistence\Cache\UserHandler.

## ◆ loadRoleDraftByRoleId()

eZ\Publish\SPI\Persistence\User\Handler::loadRoleDraftByRoleId | ( |  | $roleId | ) |

Loads a role draft by the original role ID.

Parameters

  mixed | $roleId | ID of the role the draft was created from.

Exceptions

Implemented in eZ\Publish\Core\Persistence\Legacy\User\Handler, and eZ\Publish\Core\Persistence\Cache\UserHandler.

## ◆ loadRoles()

eZ\Publish\SPI\Persistence\User\Handler::loadRoles | ( |  | ) |

Loads all roles.

Returns
  \eZ\Publish\SPI\Persistence\User\Role[]

Implemented in eZ\Publish\Core\Persistence\Legacy\User\Handler, and eZ\Publish\Core\Persistence\Cache\UserHandler.

## ◆ loadUserByToken()

eZ\Publish\SPI\Persistence\User\Handler::loadUserByToken | ( |  | $hash | ) |

Loads user with user hash.

Parameters

  string | $hash |

Exceptions

Implemented in eZ\Publish\Core\Persistence\Legacy\User\Handler, and eZ\Publish\Core\Persistence\Cache\UserHandler.

## ◆ publishRoleDraft()

eZ\Publish\SPI\Persistence\User\Handler::publishRoleDraft | ( |  | $roleDraftId | ) |

Publish the specified role draft.

Parameters

  mixed | $roleDraftId |

Implemented in eZ\Publish\Core\Persistence\Legacy\User\Handler, and eZ\Publish\Core\Persistence\Cache\UserHandler.

## ◆ removeRoleAssignment()

eZ\Publish\SPI\Persistence\User\Handler::removeRoleAssignment | ( |  | $roleAssignmentId | ) |

Un-assign a role, by assignment ID.

Parameters

  mixed | $roleAssignmentId | The assignment ID.

Implemented in eZ\Publish\Core\Persistence\Legacy\User\Handler, and eZ\Publish\Core\Persistence\Cache\UserHandler.

## ◆ unassignRole()

eZ\Publish\SPI\Persistence\User\Handler::unassignRole | ( |  | $contentId,
|  |  | $roleId
| ) |  |

Un-assign a role.

Parameters

  mixed | $contentId | The user or user group Id to un-assign the role from.
  mixed | $roleId |

Implemented in eZ\Publish\Core\Persistence\Legacy\User\Handler, and eZ\Publish\Core\Persistence\Cache\UserHandler.

## ◆ update()

eZ\Publish\SPI\Persistence\User\Handler::update | ( | User | $user | ) |

Update the user information specified by the user struct.

Parameters

  \eZ\Publish\SPI\Persistence\User | $user |

Implemented in eZ\Publish\Core\Persistence\Legacy\User\Handler, and eZ\Publish\Core\Persistence\Cache\UserHandler.

## ◆ updatePolicy()

eZ\Publish\SPI\Persistence\User\Handler::updatePolicy | ( | Policy | $policy | ) |

Update a policy.

Replaces limitations values with new values.

Parameters

  \eZ\Publish\SPI\Persistence\User\Policy | $policy |

Exceptions

Implemented in eZ\Publish\Core\Persistence\Legacy\User\Handler, and eZ\Publish\Core\Persistence\Cache\UserHandler.

## ◆ updateRole()

eZ\Publish\SPI\Persistence\User\Handler::updateRole | ( | RoleUpdateStruct | $role | ) |

Update role (draft).

Parameters

  \eZ\Publish\SPI\Persistence\User\RoleUpdateStruct | $role |

Implemented in eZ\Publish\Core\Persistence\Cache\UserHandler, and eZ\Publish\Core\Persistence\Legacy\User\Handler.

## ◆ updateUserToken()

eZ\Publish\SPI\Persistence\User\Handler::updateUserToken | ( | UserTokenUpdateStruct | $userTokenUpdateStruct | ) |

Update the user information specified by the user token struct.

Parameters

  \eZ\Publish\SPI\Persistence\User\UserTokenUpdateStruct | $userTokenUpdateStruct |

Implemented in eZ\Publish\Core\Persistence\Legacy\User\Handler, and eZ\Publish\Core\Persistence\Cache\UserHandler.

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

- SPI/Persistence/User/Handler.php

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