Class

eZ\Publish\Core\Persistence\Cache\UserHandler

class UserHandler extends AbstractHandler implements Handler

Cache handler for user module.

Methods

User create(User $user)

Create a user.

User load(mixed $userId)

Loads user with user ID.

User loadByLogin(string $login)

Loads user with user login.

User[] loadByEmail(string $email)

Loads user(s) with user email.

update(User $user)

Update the user information specified by the user struct.

delete(mixed $userId)

Delete user with the given ID.

Role createRole(RoleCreateStruct $createStruct)

Create new role.

Role createRoleDraft(mixed $roleId)

Creates a draft of existing defined role.

Role loadRole(mixed $roleId, int $status = Role::STATUS_DEFINED)

Loads a specified role (draft) by $roleId.

Role loadRoleByIdentifier(string $identifier, int $status = Role::STATUS_DEFINED)

Loads a specified role (draft) by $identifier.

Role loadRoleDraftByRoleId(mixed $roleId)

Loads a role draft by the original role ID.

Role[] loadRoles()

Loads all roles.

RoleAssignment loadRoleAssignment(mixed $roleAssignmentId)

Loads role assignment for specified assignment ID.

RoleAssignment[] loadRoleAssignmentsByRoleId(mixed $roleId)

Loads roles assignments Role.

RoleAssignment[] loadRoleAssignmentsByGroupId(mixed $groupId, bool $inherit = false)

Loads roles assignments to a user/group.

updateRole(RoleUpdateStruct $struct)

Update role (draft).

deleteRole(mixed $roleId, int $status = Role::STATUS_DEFINED)

Delete the specified role (draft).

publishRoleDraft(mixed $roleDraftId)

Publish the specified role draft.

Policy addPolicyByRoleDraft(mixed $roleId, Policy $policy)

Adds a policy to a role draft.

Policy addPolicy(mixed $roleId, Policy $policy)

Adds a policy to a role.

updatePolicy(Policy $policy)

Update a policy.

deletePolicy(mixed $policyId, mixed $roleId)

Removes a policy from a role.

Policy[] loadPoliciesByUserId(mixed $userId)

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

assignRole(mixed $contentId, mixed $roleId, array $limitation = null)

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

unassignRole(mixed $contentId, mixed $roleId)

Un-assign a role.

removeRoleAssignment(mixed $roleAssignmentId)

Un-assign a role, by assignment ID.

Details

at line 27
public User 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

User $user

Return Value

User

at line 41
public User load(mixed $userId)

Loads user with user ID.

Parameters

mixed $userId

Return Value

User

Exceptions

NotFoundException If user is not found

at line 61
public User loadByLogin(string $login)

Loads user with user login.

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

Parameters

string $login

Return Value

User

Exceptions

NotFoundException If user is not found

at line 81
public User[] loadByEmail(string $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

Return Value

User[]

at line 106
public update(User $user)

Update the user information specified by the user struct.

Parameters

User $user

at line 120
public delete(mixed $userId)

Delete user with the given ID.

Parameters

mixed $userId

at line 134
public Role createRole(RoleCreateStruct $createStruct)

Create new role.

Parameters

RoleCreateStruct $createStruct

Return Value

Role

at line 144
public Role createRoleDraft(mixed $roleId)

Creates a draft of existing defined role.

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

Parameters

mixed $roleId

Return Value

Role

Exceptions

NotFoundException If role with defined status is not found

at line 154
public Role loadRole(mixed $roleId, int $status = Role::STATUS_DEFINED)

Loads a specified role (draft) by $roleId.

Parameters

mixed $roleId
int $status One of Role::STATUSDEFINED|Role::STATUSDRAFT

Return Value

Role

Exceptions

NotFoundException If role is not found

at line 180
public Role loadRoleByIdentifier(string $identifier, int $status = Role::STATUS_DEFINED)

Loads a specified role (draft) by $identifier.

Parameters

string $identifier
int $status One of Role::STATUSDEFINED|Role::STATUSDRAFT

Return Value

Role

Exceptions

NotFoundException If role is not found

at line 206
public Role loadRoleDraftByRoleId(mixed $roleId)

Loads a role draft by the original role ID.

Parameters

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

Return Value

Role

Exceptions

NotFoundException If role is not found

at line 216
public Role[] loadRoles()

Loads all roles.

Return Value

Role[]

at line 226
public RoleAssignment loadRoleAssignment(mixed $roleAssignmentId)

Loads role assignment for specified assignment ID.

Parameters

mixed $roleAssignmentId

Return Value

RoleAssignment

Exceptions

NotFoundException If role assignment is not found

at line 246
public RoleAssignment[] loadRoleAssignmentsByRoleId(mixed $roleId)

Loads roles assignments Role.

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

Parameters

mixed $roleId

Return Value

RoleAssignment[]

at line 270
public RoleAssignment[] loadRoleAssignmentsByGroupId(mixed $groupId, bool $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.

Return Value

RoleAssignment[]

at line 309
public updateRole(RoleUpdateStruct $struct)

Update role (draft).

Parameters

RoleUpdateStruct $struct

at line 320
public deleteRole(mixed $roleId, int $status = Role::STATUS_DEFINED)

Delete the specified role (draft).

Parameters

mixed $roleId
int $status One of Role::STATUSDEFINED|Role::STATUSDRAFT

at line 335
public publishRoleDraft(mixed $roleDraftId)

Publish the specified role draft.

Parameters

mixed $roleDraftId

at line 353
public Policy addPolicyByRoleDraft(mixed $roleId, Policy $policy)

Adds a policy to a role draft.

Parameters

mixed $roleId
Policy $policy

Return Value

Policy

Exceptions

InvalidArgumentException If $policy->limitation is empty (null, empty string/array..)

at line 363
public Policy addPolicy(mixed $roleId, Policy $policy)

Adds a policy to a role.

Parameters

mixed $roleId
Policy $policy

Return Value

Policy

Exceptions

InvalidArgumentException If $policy->limitation is empty (null, empty string/array..)

at line 376
public updatePolicy(Policy $policy)

Update a policy.

Replaces limitations values with new values.

Parameters

Policy $policy

Exceptions

InvalidArgumentException If $policy->limitation is empty (null, empty string/array..)

at line 389
public deletePolicy(mixed $policyId, mixed $roleId)

Removes a policy from a role.

Parameters

mixed $policyId
mixed $roleId

at line 400
public Policy[] loadPoliciesByUserId(mixed $userId)

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

Parameters

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

Return Value

Policy[]

at line 410
public assignRole(mixed $contentId, mixed $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

at line 423
public unassignRole(mixed $contentId, mixed $roleId)

Un-assign a role.

Parameters

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

at line 436
public removeRoleAssignment(mixed $roleAssignmentId)

Un-assign a role, by assignment ID.

Parameters

mixed $roleAssignmentId The assignment ID.