Class

eZ\Publish\Core\Persistence\Legacy\User\Handler

class Handler implements Handler

Storage Engine handler for user module.

Methods

__construct(Gateway $userGateway, Gateway $roleGateway, Mapper $mapper, LimitationConverter $limitationConverter)

Construct from userGateway.

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 draft.

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 and $status.

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

Loads a specified role (draft) by $identifier and $status.

Role loadRoleDraftByRoleId(mixed $roleId)

Loads a role draft by the original role ID.

Role[] loadRoles()

Loads all roles.

updateRole(RoleUpdateStruct $role)

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.

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.

Details

at line 62
public __construct(Gateway $userGateway, Gateway $roleGateway, Mapper $mapper, LimitationConverter $limitationConverter)

Construct from userGateway.

Parameters

Gateway $userGateway
Gateway $roleGateway
Mapper $mapper
LimitationConverter $limitationConverter

at line 80
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 96
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 116
public User loadByLogin(string $login)

Loads user with user login.

Parameters

string $login

Return Value

User

Exceptions

NotFoundException If user is not found

at line 139
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.

Parameters

string $email

Return Value

User[]

at line 155
public update(User $user)

Update the user information specified by the user struct.

Parameters

User $user

at line 165
public delete(mixed $userId)

Delete user with the given ID.

Parameters

mixed $userId

at line 179
public Role createRole(RoleCreateStruct $createStruct)

Create new role draft.

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

Parameters

RoleCreateStruct $createStruct

Return Value

Role

at line 195
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 242
public Role loadRole(mixed $roleId, int $status = Role::STATUS_DEFINED)

Loads a specified role (draft) by $roleId and $status.

Parameters

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

Return Value

Role

Exceptions

NotFoundException If role with given status does not exist

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

Loads a specified role (draft) by $identifier and $status.

Parameters

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

Return Value

Role

Exceptions

NotFoundException If role is not found

at line 293
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 314
public Role[] loadRoles()

Loads all roles.

Return Value

Role[]

at line 333
public updateRole(RoleUpdateStruct $role)

Update role (draft).

Parameters

RoleUpdateStruct $role

at line 344
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 360
public publishRoleDraft(mixed $roleDraftId)

Publish the specified role draft.

Parameters

mixed $roleDraftId

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

Adds a policy to a role draft.

Parameters

mixed $roleId
Policy $policy

Return Value

Policy

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

Adds a policy to a role.

Parameters

mixed $roleId
Policy $policy

Return Value

Policy

at line 437
public updatePolicy(Policy $policy)

Update a policy.

Replaces limitations values with new values.

Parameters

Policy $policy

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

Removes a policy from a role.

Parameters

mixed $policyId
mixed $roleId

at line 467
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 502
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 514
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 524
public removeRoleAssignment(mixed $roleAssignmentId)

Un-assign a role by assignment ID.

Parameters

mixed $roleAssignmentId The assignment ID.

at line 538
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 558
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 580
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[]