eZPublishCommunityProject  2013.4
eZ\Publish\Core\SignalSlot\RoleService Class Reference
+ Inheritance diagram for eZ\Publish\Core\SignalSlot\RoleService:
+ Collaboration diagram for eZ\Publish\Core\SignalSlot\RoleService:

Public Member Functions

 __construct (RoleServiceInterface $service, SignalDispatcher $signalDispatcher)
 Constructor. More...
 
 addPolicy (Role $role, PolicyCreateStruct $policyCreateStruct)
 Adds a new policy to the role. More...
 
 assignRoleToUser (Role $role, User $user, RoleLimitation $roleLimitation=null)
 Assigns a role to the given user. More...
 
 assignRoleToUserGroup (Role $role, UserGroup $userGroup, RoleLimitation $roleLimitation=null)
 Assigns a role to the given user group. More...
 
 createRole (RoleCreateStruct $roleCreateStruct)
 Creates a new Role. More...
 
 deleteRole (Role $role)
 Deletes the given role. More...
 
 getLimitationType ($identifier)
 Returns the LimitationType registered with the given identifier. More...
 
 getLimitationTypesByModuleFunction ($module, $function)
 Returns the LimitationType's assigned to a given module/function. More...
 
 getRoleAssignments (Role $role)
 Returns the assigned user and user groups to this role. More...
 
 getRoleAssignmentsForUser (User $user)
 Returns the roles assigned to the given user. More...
 
 getRoleAssignmentsForUserGroup (UserGroup $userGroup)
 Returns the roles assigned to the given user group. More...
 
 loadPoliciesByUserId ($userId)
 Loads all policies from roles which are assigned to a user or to user groups to which the user belongs. More...
 
 loadRole ($id)
 Loads a role for the given id. More...
 
 loadRoleByIdentifier ($identifier)
 Loads a role for the given identifier. More...
 
 loadRoles ()
 Loads all roles. More...
 
 newPolicyCreateStruct ($module, $function)
 Instantiates a policy create class. More...
 
 newPolicyUpdateStruct ()
 Instantiates a policy update class. More...
 
 newRoleCreateStruct ($name)
 Instantiates a role create class. More...
 
 newRoleUpdateStruct ()
 Instantiates a policy update class. More...
 
 removePolicy (Role $role, Policy $policy)
 removes a policy from the role More...
 
 unassignRoleFromUser (Role $role, User $user)
 removes a role from the given user. More...
 
 unassignRoleFromUserGroup (Role $role, UserGroup $userGroup)
 removes a role from the given user group. More...
 
 updatePolicy (Policy $policy, PolicyUpdateStruct $policyUpdateStruct)
 Updates the limitations of a policy. More...
 
 updateRole (Role $role, RoleUpdateStruct $roleUpdateStruct)
 Updates the name of the role. More...
 

Protected Attributes

 $service
 
 $signalDispatcher
 

Constructor & Destructor Documentation

eZ\Publish\Core\SignalSlot\RoleService::__construct ( RoleServiceInterface  $service,
SignalDispatcher  $signalDispatcher 
)

Constructor.

Construct service object from aggregated service and signal dispatcher

Parameters
\eZ\Publish\API\Repository\RoleService$service
\eZ\Publish\Core\SignalSlot\SignalDispatcher$signalDispatcher

Member Function Documentation

eZ\Publish\Core\SignalSlot\RoleService::addPolicy ( Role  $role,
PolicyCreateStruct  $policyCreateStruct 
)

Adds a new policy to the role.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the authenticated user is not allowed to add a policy
Parameters
\eZ\Publish\API\Repository\Values\User\Role$role
\eZ\Publish\API\Repository\Values\User\PolicyCreateStruct$policyCreateStruct
Returns

Implements eZ\Publish\API\Repository\RoleService.

eZ\Publish\Core\SignalSlot\RoleService::assignRoleToUser ( Role  $role,
User  $user,
RoleLimitation  $roleLimitation = null 
)

Assigns a role to the given user.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the authenticated user is not allowed to assign a role
Parameters
\eZ\Publish\API\Repository\Values\User\Role$role
\eZ\Publish\API\Repository\Values\User\User$user
\eZ\Publish\API\Repository\Values\User\Limitation\RoleLimitation$roleLimitationan optional role limitation (which is either a subtree limitation or section limitation)

Implements eZ\Publish\API\Repository\RoleService.

eZ\Publish\Core\SignalSlot\RoleService::assignRoleToUserGroup ( Role  $role,
UserGroup  $userGroup,
RoleLimitation  $roleLimitation = null 
)

Assigns a role to the given user group.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the authenticated user is not allowed to assign a role
Parameters
\eZ\Publish\API\Repository\Values\User\Role$role
\eZ\Publish\API\Repository\Values\User\UserGroup$userGroup
\eZ\Publish\API\Repository\Values\User\Limitation\RoleLimitation$roleLimitationan optional role limitation (which is either a subtree limitation or section limitation)

Implements eZ\Publish\API\Repository\RoleService.

eZ\Publish\Core\SignalSlot\RoleService::createRole ( RoleCreateStruct  $roleCreateStruct)

Creates a new Role.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the authenticated user is not allowed to create a role
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionif the name of the role already exists
Parameters
\eZ\Publish\API\Repository\Values\User\RoleCreateStruct$roleCreateStruct
Returns

Implements eZ\Publish\API\Repository\RoleService.

eZ\Publish\Core\SignalSlot\RoleService::deleteRole ( Role  $role)

Deletes the given role.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the authenticated user is not allowed to delete this role
Parameters
\eZ\Publish\API\Repository\Values\User\Role$role

Implements eZ\Publish\API\Repository\RoleService.

eZ\Publish\Core\SignalSlot\RoleService::getLimitationType (   $identifier)

Returns the LimitationType registered with the given identifier.

Parameters
string$identifier
Returns
Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionif there is no LimitationType with $identifier

Implements eZ\Publish\API\Repository\RoleService.

eZ\Publish\Core\SignalSlot\RoleService::getLimitationTypesByModuleFunction (   $module,
  $function 
)

Returns the LimitationType's assigned to a given module/function.

Typically used for:

  • Internal validation limitation value use on Policies
  • Role admin gui for editing policy limitations incl list limitation options via valueSchema()
Parameters
string$moduleLegacy name of "controller", it's a unique identifier like "content"
string$functionLegacy name of a controller "action", it's a unique within the controller like "read"
Returns
[]
Exceptions
\eZ\Publish\API\Repository\Exceptions\BadStateExceptionIf module/function to limitation type mapping refers to a non existing identifier.

Implements eZ\Publish\API\Repository\RoleService.

eZ\Publish\Core\SignalSlot\RoleService::getRoleAssignments ( Role  $role)

Returns the assigned user and user groups to this role.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the authenticated user is not allowed to read a role
Parameters
\eZ\Publish\API\Repository\Values\User\Role$role
Returns
[]

Implements eZ\Publish\API\Repository\RoleService.

eZ\Publish\Core\SignalSlot\RoleService::getRoleAssignmentsForUser ( User  $user)

Returns the roles assigned to the given user.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the authenticated user is not allowed to read a user
Parameters
\eZ\Publish\API\Repository\Values\User\User$user
Returns
[]

Implements eZ\Publish\API\Repository\RoleService.

eZ\Publish\Core\SignalSlot\RoleService::getRoleAssignmentsForUserGroup ( UserGroup  $userGroup)

Returns the roles assigned to the given user group.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the authenticated user is not allowed to read a user group
Parameters
\eZ\Publish\API\Repository\Values\User\UserGroup$userGroup
Returns
[]

Implements eZ\Publish\API\Repository\RoleService.

eZ\Publish\Core\SignalSlot\RoleService::loadPoliciesByUserId (   $userId)

Loads all policies from roles which are assigned to a user or to user groups to which the user belongs.

Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionif a user with the given id was not found
Parameters
int$userId
Returns
[]

Implements eZ\Publish\API\Repository\RoleService.

eZ\Publish\Core\SignalSlot\RoleService::loadRole (   $id)

Loads a role for the given id.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the authenticated user is not allowed to read this role
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionif a role with the given name was not found
Parameters
mixed$id
Returns

Implements eZ\Publish\API\Repository\RoleService.

eZ\Publish\Core\SignalSlot\RoleService::loadRoleByIdentifier (   $identifier)

Loads a role for the given identifier.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the authenticated user is not allowed to read this role
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionif a role with the given name was not found
Parameters
string$identifier
Returns

Implements eZ\Publish\API\Repository\RoleService.

eZ\Publish\Core\SignalSlot\RoleService::loadRoles ( )

Loads all roles.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the authenticated user is not allowed to read the roles
Returns
[]

Implements eZ\Publish\API\Repository\RoleService.

eZ\Publish\Core\SignalSlot\RoleService::newPolicyCreateStruct (   $module,
  $function 
)

Instantiates a policy create class.

Parameters
string$module
string$function
Returns

Implements eZ\Publish\API\Repository\RoleService.

eZ\Publish\Core\SignalSlot\RoleService::newPolicyUpdateStruct ( )

Instantiates a policy update class.

Returns

Implements eZ\Publish\API\Repository\RoleService.

eZ\Publish\Core\SignalSlot\RoleService::newRoleCreateStruct (   $name)

Instantiates a role create class.

Parameters
string$name
Returns

Implements eZ\Publish\API\Repository\RoleService.

eZ\Publish\Core\SignalSlot\RoleService::newRoleUpdateStruct ( )

Instantiates a policy update class.

Returns

Implements eZ\Publish\API\Repository\RoleService.

eZ\Publish\Core\SignalSlot\RoleService::removePolicy ( Role  $role,
Policy  $policy 
)

removes a policy from the role

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the authenticated user is not allowed to remove a policy
Parameters
\eZ\Publish\API\Repository\Values\User\Role$role
\eZ\Publish\API\Repository\Values\User\Policy$policythe policy to remove from the role
Returns
the updated role

Implements eZ\Publish\API\Repository\RoleService.

eZ\Publish\Core\SignalSlot\RoleService::unassignRoleFromUser ( Role  $role,
User  $user 
)

removes a role from the given user.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the authenticated user is not allowed to remove a role
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionIf the role is not assigned to the user
Parameters
\eZ\Publish\API\Repository\Values\User\Role$role
\eZ\Publish\API\Repository\Values\User\User$user

Implements eZ\Publish\API\Repository\RoleService.

eZ\Publish\Core\SignalSlot\RoleService::unassignRoleFromUserGroup ( Role  $role,
UserGroup  $userGroup 
)

removes a role from the given user group.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the authenticated user is not allowed to remove a role
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionIf the role is not assigned to the given user group
Parameters
\eZ\Publish\API\Repository\Values\User\Role$role
\eZ\Publish\API\Repository\Values\User\UserGroup$userGroup

Implements eZ\Publish\API\Repository\RoleService.

eZ\Publish\Core\SignalSlot\RoleService::updatePolicy ( Policy  $policy,
PolicyUpdateStruct  $policyUpdateStruct 
)

Updates the limitations of a policy.

The module and function cannot be changed and the limitations are replaced by the ones in $roleUpdateStruct

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the authenticated user is not allowed to u�date a policy
Parameters
\eZ\Publish\API\Repository\Values\User\PolicyUpdateStruct$policyUpdateStruct
\eZ\Publish\API\Repository\Values\User\Policy$policy
Returns

Implements eZ\Publish\API\Repository\RoleService.

eZ\Publish\Core\SignalSlot\RoleService::updateRole ( Role  $role,
RoleUpdateStruct  $roleUpdateStruct 
)

Updates the name of the role.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the authenticated user is not allowed to update a role
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionif the name of the role already exists
Parameters
\eZ\Publish\API\Repository\Values\User\Role$role
\eZ\Publish\API\Repository\Values\User\RoleUpdateStruct$roleUpdateStruct
Returns

Implements eZ\Publish\API\Repository\RoleService.

Member Data Documentation

eZ\Publish\Core\SignalSlot\RoleService::$service
protected
eZ\Publish\Core\SignalSlot\RoleService::$signalDispatcher
protected

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