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

Inheritance: implements eZ\Publish\SPI\Persistence\User\Handler
Show file Open project: ezsystems/ezpublish-kernel

Protected Properties

Property Type Description
$limitationConverter eZ\Publish\Core\Persistence\Legacy\User\Role\LimitationConverter
$mapper Mapper Mapper for user related objects.
$roleGateway eZ\Publish\Core\Persistence\Legacy\User\Role\Gateway Gateway for storing role data.
$userGateway Gateway Gateway for storing user data.

Public Methods

Method Description
__construct ( Gateway $userGateway, Gateway $roleGateway, Mapper $mapper, LimitationConverter $limitationConverter ) Construct from userGateway.
addPolicy ( mixed $roleId, eZ\Publish\SPI\Persistence\User\Policy $policy ) : eZ\Publish\SPI\Persistence\User\Policy Adds a policy to a role.
addPolicyByRoleDraft ( mixed $roleId, eZ\Publish\SPI\Persistence\User\Policy $policy ) : eZ\Publish\SPI\Persistence\User\Policy Adds a policy to a role draft.
assignRole ( mixed $contentId, mixed $roleId, array $limitation = null ) Assigns role to a user or user group with given limitations.
create ( eZ\Publish\SPI\Persistence\User $user ) : eZ\Publish\SPI\Persistence\User Create a user.
createRole ( eZ\Publish\SPI\Persistence\User\RoleCreateStruct $createStruct ) : eZ\Publish\SPI\Persistence\User\Role Create new role draft.
createRoleDraft ( mixed $roleId ) : eZ\Publish\SPI\Persistence\User\Role Creates a draft of existing defined role.
delete ( mixed $userId ) Delete user with the given ID.
deletePolicy ( mixed $policyId ) Removes a policy from a role.
deleteRole ( mixed $roleId, integer $status = Role::STATUS_DEFINED ) Delete the specified role (draft).
load ( mixed $userId ) : eZ\Publish\SPI\Persistence\User Loads user with user ID.
loadByEmail ( string $email ) : eZ\Publish\SPI\Persistence\User[] Loads user(s) with user email.
loadByLogin ( string $login ) : eZ\Publish\SPI\Persistence\User Loads user with user login.
loadPoliciesByUserId ( mixed $userId ) : eZ\Publish\SPI\Persistence\User\Policy[] Returns the user policies associated with the user (including inherited policies from user groups).
loadRole ( mixed $roleId, integer $status = Role::STATUS_DEFINED ) : eZ\Publish\SPI\Persistence\User\Role Loads a specified role (draft) by $roleId and $status.
loadRoleAssignment ( mixed $roleAssignmentId ) : eZ\Publish\SPI\Persistence\User\RoleAssignment Loads role assignment for specified assignment ID.
loadRoleAssignmentsByGroupId ( mixed $groupId, boolean $inherit = false ) : eZ\Publish\SPI\Persistence\User\RoleAssignment[] Loads roles assignments to a user/group.
loadRoleAssignmentsByRoleId ( mixed $roleId ) : eZ\Publish\SPI\Persistence\User\RoleAssignment[] Loads roles assignments Role.
loadRoleByIdentifier ( string $identifier, integer $status = Role::STATUS_DEFINED ) : eZ\Publish\SPI\Persistence\User\Role Loads a specified role (draft) by $identifier and $status.
loadRoleDraftByRoleId ( mixed $roleId ) : eZ\Publish\SPI\Persistence\User\Role Loads a role draft by the original role ID.
loadRoles ( ) : eZ\Publish\SPI\Persistence\User\Role[] Loads all roles.
publishRoleDraft ( mixed $roleDraftId ) Publish the specified role draft.
removeRoleAssignment ( mixed $roleAssignmentId ) Un-assign a role by assignment ID.
unassignRole ( mixed $contentId, mixed $roleId ) Un-assign a role.
update ( eZ\Publish\SPI\Persistence\User $user ) Update the user information specified by the user struct.
updatePolicy ( eZ\Publish\SPI\Persistence\User\Policy $policy ) Update a policy.
updateRole ( eZ\Publish\SPI\Persistence\User\RoleUpdateStruct $role ) Update role (draft).

Protected Methods

Method Description
internalCreateRole ( eZ\Publish\SPI\Persistence\User\RoleCreateStruct $createStruct, mixed | null $roleId = null ) : eZ\Publish\SPI\Persistence\User\Role Internal method for creating Role.

Method Details

__construct() public method

Construct from userGateway.
public __construct ( Gateway $userGateway, Gateway $roleGateway, Mapper $mapper, LimitationConverter $limitationConverter )
$userGateway Gateway
$roleGateway eZ\Publish\Core\Persistence\Legacy\User\Role\Gateway
$mapper Mapper
$limitationConverter eZ\Publish\Core\Persistence\Legacy\User\Role\LimitationConverter

addPolicy() public method

Adds a policy to a role.
public addPolicy ( mixed $roleId, eZ\Publish\SPI\Persistence\User\Policy $policy ) : eZ\Publish\SPI\Persistence\User\Policy
$roleId mixed
$policy eZ\Publish\SPI\Persistence\User\Policy
return eZ\Publish\SPI\Persistence\User\Policy

addPolicyByRoleDraft() public method

Adds a policy to a role draft.
public addPolicyByRoleDraft ( mixed $roleId, eZ\Publish\SPI\Persistence\User\Policy $policy ) : eZ\Publish\SPI\Persistence\User\Policy
$roleId mixed
$policy eZ\Publish\SPI\Persistence\User\Policy
return eZ\Publish\SPI\Persistence\User\Policy

assignRole() public method

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.
public assignRole ( mixed $contentId, mixed $roleId, array $limitation = null )
$contentId mixed The groupId or userId to assign the role to.
$roleId mixed
$limitation array

create() public method

The User struct used to create the user will contain an ID which is used to reference the user.
public create ( eZ\Publish\SPI\Persistence\User $user ) : eZ\Publish\SPI\Persistence\User
$user eZ\Publish\SPI\Persistence\User
return eZ\Publish\SPI\Persistence\User

createRole() public method

Sets status to Role::STATUS_DRAFT on the new returned draft.
public createRole ( eZ\Publish\SPI\Persistence\User\RoleCreateStruct $createStruct ) : eZ\Publish\SPI\Persistence\User\Role
$createStruct eZ\Publish\SPI\Persistence\User\RoleCreateStruct
return eZ\Publish\SPI\Persistence\User\Role

createRoleDraft() public method

Sets status to Role::STATUS_DRAFT on the new returned draft.
public createRoleDraft ( mixed $roleId ) : eZ\Publish\SPI\Persistence\User\Role
$roleId mixed
return eZ\Publish\SPI\Persistence\User\Role

delete() public method

Delete user with the given ID.
public delete ( mixed $userId )
$userId mixed

deletePolicy() public method

Removes a policy from a role.
public deletePolicy ( mixed $policyId )
$policyId mixed

deleteRole() public method

Delete the specified role (draft).
public deleteRole ( mixed $roleId, integer $status = Role::STATUS_DEFINED )
$roleId mixed
$status integer One of Role::STATUS_DEFINED|Role::STATUS_DRAFT

internalCreateRole() protected method

Used by self::createRole() and self::createRoleDraft()
protected internalCreateRole ( eZ\Publish\SPI\Persistence\User\RoleCreateStruct $createStruct, mixed | null $roleId = null ) : eZ\Publish\SPI\Persistence\User\Role
$createStruct eZ\Publish\SPI\Persistence\User\RoleCreateStruct
$roleId mixed | null Used by self::createRoleDraft() to retain Role id in the draft
return eZ\Publish\SPI\Persistence\User\Role

load() public method

Loads user with user ID.
public load ( mixed $userId ) : eZ\Publish\SPI\Persistence\User
$userId mixed
return eZ\Publish\SPI\Persistence\User

loadByEmail() public method

As earlier eZ Publish versions supported several users having same email (ini config), this function may return several users.
public loadByEmail ( string $email ) : eZ\Publish\SPI\Persistence\User[]
$email string
return eZ\Publish\SPI\Persistence\User[]

loadByLogin() public method

Loads user with user login.
public loadByLogin ( string $login ) : eZ\Publish\SPI\Persistence\User
$login string
return eZ\Publish\SPI\Persistence\User

loadPoliciesByUserId() public method

Returns the user policies associated with the user (including inherited policies from user groups).
public loadPoliciesByUserId ( mixed $userId ) : eZ\Publish\SPI\Persistence\User\Policy[]
$userId mixed
return eZ\Publish\SPI\Persistence\User\Policy[]

loadRole() public method

Loads a specified role (draft) by $roleId and $status.
public loadRole ( mixed $roleId, integer $status = Role::STATUS_DEFINED ) : eZ\Publish\SPI\Persistence\User\Role
$roleId mixed
$status integer One of Role::STATUS_DEFINED|Role::STATUS_DRAFT
return eZ\Publish\SPI\Persistence\User\Role

loadRoleAssignment() public method

Loads role assignment for specified assignment ID.
public loadRoleAssignment ( mixed $roleAssignmentId ) : eZ\Publish\SPI\Persistence\User\RoleAssignment
$roleAssignmentId mixed
return eZ\Publish\SPI\Persistence\User\RoleAssignment

loadRoleAssignmentsByGroupId() public method

Role Assignments with same roleId and limitationIdentifier will be merged together into one.
public loadRoleAssignmentsByGroupId ( mixed $groupId, boolean $inherit = false ) : eZ\Publish\SPI\Persistence\User\RoleAssignment[]
$groupId mixed 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.
$inherit boolean If true also return inherited role assignments from user groups.
return eZ\Publish\SPI\Persistence\User\RoleAssignment[]

loadRoleAssignmentsByRoleId() public method

Role Assignments with same roleId and limitationIdentifier will be merged together into one.
public loadRoleAssignmentsByRoleId ( mixed $roleId ) : eZ\Publish\SPI\Persistence\User\RoleAssignment[]
$roleId mixed
return eZ\Publish\SPI\Persistence\User\RoleAssignment[]

loadRoleByIdentifier() public method

Loads a specified role (draft) by $identifier and $status.
public loadRoleByIdentifier ( string $identifier, integer $status = Role::STATUS_DEFINED ) : eZ\Publish\SPI\Persistence\User\Role
$identifier string
$status integer One of Role::STATUS_DEFINED|Role::STATUS_DRAFT
return eZ\Publish\SPI\Persistence\User\Role

loadRoleDraftByRoleId() public method

Loads a role draft by the original role ID.
public loadRoleDraftByRoleId ( mixed $roleId ) : eZ\Publish\SPI\Persistence\User\Role
$roleId mixed ID of the role the draft was created from.
return eZ\Publish\SPI\Persistence\User\Role

loadRoles() public method

Loads all roles.
public loadRoles ( ) : eZ\Publish\SPI\Persistence\User\Role[]
return eZ\Publish\SPI\Persistence\User\Role[]

publishRoleDraft() public method

Publish the specified role draft.
public publishRoleDraft ( mixed $roleDraftId )
$roleDraftId mixed

removeRoleAssignment() public method

Un-assign a role by assignment ID.
public removeRoleAssignment ( mixed $roleAssignmentId )
$roleAssignmentId mixed The assignment ID.

unassignRole() public method

Un-assign a role.
public unassignRole ( mixed $contentId, mixed $roleId )
$contentId mixed The user or user group Id to un-assign the role from.
$roleId mixed

update() public method

Update the user information specified by the user struct.
public update ( eZ\Publish\SPI\Persistence\User $user )
$user eZ\Publish\SPI\Persistence\User

updatePolicy() public method

Replaces limitations values with new values.
public updatePolicy ( eZ\Publish\SPI\Persistence\User\Policy $policy )
$policy eZ\Publish\SPI\Persistence\User\Policy

updateRole() public method

Update role (draft).
public updateRole ( eZ\Publish\SPI\Persistence\User\RoleUpdateStruct $role )
$role eZ\Publish\SPI\Persistence\User\RoleUpdateStruct

Property Details

$limitationConverter protected property

protected LimitationConverter,eZ\Publish\Core\Persistence\Legacy\User\Role $limitationConverter
return eZ\Publish\Core\Persistence\Legacy\User\Role\LimitationConverter

$mapper protected property

Mapper for user related objects.
protected Mapper,eZ\Publish\Core\Persistence\Legacy\User $mapper
return Mapper

$roleGateway protected property

Gateway for storing role data.
protected Gateway,eZ\Publish\Core\Persistence\Legacy\User\Role $roleGateway
return eZ\Publish\Core\Persistence\Legacy\User\Role\Gateway

$userGateway protected property

Gateway for storing user data.
protected Gateway,eZ\Publish\Core\Persistence\Legacy\User $userGateway
return Gateway