eZPublishCommunityProject  2013.9
eZ\Publish\Core\Persistence\InMemory\UserHandler Class Reference

Storage Engine handler for user module. More...

+ Inheritance diagram for eZ\Publish\Core\Persistence\InMemory\UserHandler:
+ Collaboration diagram for eZ\Publish\Core\Persistence\InMemory\UserHandler:

Public Member Functions

 __construct (Handler $handler, Backend $backend)
 Setups current handler instance with reference to Handler object that created it. More...
 
 addPolicy ($roleId, Policy $policy)
 Adds a policy to a role. More...
 
 assignRole ($contentId, $roleId, array $limitation=null)
 Assigns role to a user or user group with given limitations. More...
 
 create (User $user)
 Create a user. More...
 
 createRole (Role $role)
 Create new role. More...
 
 delete ($userId)
 Delete user with the given ID. More...
 
 deleteRole ($roleId)
 Delete the specified role. More...
 
 load ($userId)
 Loads user with user ID. More...
 
 loadByEmail ($email)
 Loads user(s) with user email. More...
 
 loadByLogin ($login)
 Loads user with user login. More...
 
 loadPoliciesByUserId ($userId)
 Returns the user policies associated with the user (including inherited policies from user groups) More...
 
 loadRole ($roleId)
 Loads a specified role by id. More...
 
 loadRoleAssignmentsByGroupId ($groupId, $inherit=false)
 Loads roles assignments to a user/group. More...
 
 loadRoleAssignmentsByRoleId ($roleId)
 Loads roles assignments Role. More...
 
 loadRoleByIdentifier ($identifier)
 Loads a specified role by $identifier. More...
 
 loadRoles ()
 Loads all roles. More...
 
 removePolicy ($roleId, $policyId)
 Removes a policy from a role. More...
 
 unAssignRole ($contentId, $roleId)
 Un-assign a role. More...
 
 update (User $user)
 Update the user information specified by the user struct. More...
 
 updatePolicy (Policy $policy)
 Update a policy. More...
 
 updateRole (RoleUpdateStruct $role)
 Update role. More...
 

Protected Member Functions

 getPermissionsForObject (Content $content, $typeId, array &$policies)
 

Protected Attributes

 $backend
 
 $handler
 

Detailed Description

Storage Engine handler for user module.

Constructor & Destructor Documentation

eZ\Publish\Core\Persistence\InMemory\UserHandler::__construct ( Handler  $handler,
Backend  $backend 
)

Setups current handler instance with reference to Handler object that created it.

Parameters
\eZ\Publish\Core\Persistence\InMemory\Handler$handler
\eZ\Publish\Core\Persistence\InMemory\Backend$backendThe storage engine backend

Member Function Documentation

eZ\Publish\Core\Persistence\InMemory\UserHandler::addPolicy (   $roleId,
Policy  $policy 
)

Adds a policy to a role.

Parameters
mixed$roleId
\eZ\Publish\SPI\Persistence\User\Policy$policy
Returns
Todo:
Throw on invalid Role Id?
Exceptions
\eZ\Publish\Core\Base\Exceptions\InvalidArgumentValueIf $policy->limitation is empty (null, empty string/array..)

Implements eZ\Publish\SPI\Persistence\User\Handler.

Referenced by eZ\Publish\Core\Persistence\InMemory\UserHandler\createRole().

eZ\Publish\Core\Persistence\InMemory\UserHandler::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$contentIdThe groupId or userId to assign the role to.
mixed$roleId
array$limitation
Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionIf group or role is not found
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionIf group is not of user_group Content Type

Implements eZ\Publish\SPI\Persistence\User\Handler.

eZ\Publish\Core\Persistence\InMemory\UserHandler::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
Exceptions
LogicExceptionIf no id was provided or if it already exists
Returns

Implements eZ\Publish\SPI\Persistence\User\Handler.

eZ\Publish\Core\Persistence\InMemory\UserHandler::createRole ( Role  $role)

Create new role.

Parameters
\eZ\Publish\SPI\Persistence\User\Role$role
Returns

Implements eZ\Publish\SPI\Persistence\User\Handler.

eZ\Publish\Core\Persistence\InMemory\UserHandler::delete (   $userId)

Delete user with the given ID.

Parameters
mixed$userId

Implements eZ\Publish\SPI\Persistence\User\Handler.

eZ\Publish\Core\Persistence\InMemory\UserHandler::deleteRole (   $roleId)

Delete the specified role.

Parameters
mixed$roleId

Implements eZ\Publish\SPI\Persistence\User\Handler.

eZ\Publish\Core\Persistence\InMemory\UserHandler::getPermissionsForObject ( Content  $content,
  $typeId,
array &  $policies 
)
protected
Parameters
\eZ\Publish\SPI\Persistence\Content$content
mixed$typeId
array$policies
Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionIf $content is not type $typeId
Returns
void

Referenced by eZ\Publish\Core\Persistence\InMemory\UserHandler\loadPoliciesByUserId().

eZ\Publish\Core\Persistence\InMemory\UserHandler::load (   $userId)

Loads user with user ID.

Parameters
mixed$userId
Returns

Implements eZ\Publish\SPI\Persistence\User\Handler.

eZ\Publish\Core\Persistence\InMemory\UserHandler::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.

Parameters
string$email
Returns
[]

Implements eZ\Publish\SPI\Persistence\User\Handler.

eZ\Publish\Core\Persistence\InMemory\UserHandler::loadByLogin (   $login)

Loads user with user login.

Parameters
string$login
Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionIf user is not found
Returns

Implements eZ\Publish\SPI\Persistence\User\Handler.

eZ\Publish\Core\Persistence\InMemory\UserHandler::loadPoliciesByUserId (   $userId)

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

Parameters
mixed$userId
Returns
[]
Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionIf user (it's content object atm) is not found
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionIf user is not of user Content Type

Implements eZ\Publish\SPI\Persistence\User\Handler.

eZ\Publish\Core\Persistence\InMemory\UserHandler::loadRole (   $roleId)

Loads a specified role by id.

Parameters
mixed$roleId
Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionIf role is not found
Returns

Implements eZ\Publish\SPI\Persistence\User\Handler.

eZ\Publish\Core\Persistence\InMemory\UserHandler::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$groupIdIn 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.
boolean$inheritIf true also return inherited role assignments from user groups.
Exceptions
\LogicExceptionInternal data corruption error getRoleAssignmentForContent()
Returns
[]

Implements eZ\Publish\SPI\Persistence\User\Handler.

eZ\Publish\Core\Persistence\InMemory\UserHandler::loadRoleAssignmentsByRoleId (   $roleId)

Loads roles assignments Role.

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

Parameters
mixed$roleId
Returns
[]

Implements eZ\Publish\SPI\Persistence\User\Handler.

eZ\Publish\Core\Persistence\InMemory\UserHandler::loadRoleByIdentifier (   $identifier)

Loads a specified role by $identifier.

Parameters
string$identifier
Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionIf role is not found
Returns

Implements eZ\Publish\SPI\Persistence\User\Handler.

eZ\Publish\Core\Persistence\InMemory\UserHandler::loadRoles ( )

Loads all roles.

Returns
[]

Implements eZ\Publish\SPI\Persistence\User\Handler.

eZ\Publish\Core\Persistence\InMemory\UserHandler::removePolicy (   $roleId,
  $policyId 
)

Removes a policy from a role.

Parameters
mixed$roleId
mixed$policyId
Todo:
Throw exception on missing role / policy?
Returns
void

Implements eZ\Publish\SPI\Persistence\User\Handler.

eZ\Publish\Core\Persistence\InMemory\UserHandler::unAssignRole (   $contentId,
  $roleId 
)

Un-assign a role.

Parameters
mixed$contentIdThe user or user group Id to un-assign the role from.
mixed$roleId
Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionIf group or role is not found
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionIf group is not of user[_group] Content Type
\eZ\Publish\Core\Base\Exceptions\InvalidArgumentValueIf group does not contain role

Implements eZ\Publish\SPI\Persistence\User\Handler.

eZ\Publish\Core\Persistence\InMemory\UserHandler::update ( User  $user)

Update the user information specified by the user struct.

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

Implements eZ\Publish\SPI\Persistence\User\Handler.

eZ\Publish\Core\Persistence\InMemory\UserHandler::updatePolicy ( Policy  $policy)

Update a policy.

Replaces limitations values with new values.

Parameters
\eZ\Publish\SPI\Persistence\User\Policy$policy
Exceptions
\eZ\Publish\Core\Base\Exceptions\InvalidArgumentValueIf $policy->limitation is empty (null, empty string/array..)

Implements eZ\Publish\SPI\Persistence\User\Handler.

eZ\Publish\Core\Persistence\InMemory\UserHandler::updateRole ( RoleUpdateStruct  $role)

Update role.

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

Implements eZ\Publish\SPI\Persistence\User\Handler.

Member Data Documentation

eZ\Publish\Core\Persistence\InMemory\UserHandler::$backend
protected
eZ\Publish\Core\Persistence\InMemory\UserHandler::$handler
protected

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