eZPublishCommunityProject  2012.12
eZ\Publish\Core\REST\Client\RoleService Class Reference

Implementation of the eZ\Publish\API\Repository\RoleServiceinterface. More...

+ Inheritance diagram for eZ\Publish\Core\REST\Client\RoleService:
+ Collaboration diagram for eZ\Publish\Core\REST\Client\RoleService:

Public Member Functions

 __construct (UserService $userService, HttpClient $client, Dispatcher $inputDispatcher, Visitor $outputVisitor, UrlHandler $urlHandler)
 
 addPolicy (APIRole $role, APIPolicyCreateStruct $policyCreateStruct)
 Adds a new policy to the role. More...
 
 assignRoleToUser (APIRole $role, User $user, RoleLimitation $roleLimitation=null)
 Assigns a role to the given user. More...
 
 assignRoleToUserGroup (APIRole $role, UserGroup $userGroup, RoleLimitation $roleLimitation=null)
 Assigns a role to the given user group. More...
 
 createRole (APIRoleCreateStruct $roleCreateStruct)
 Creates a new Role. More...
 
 deleteRole (APIRole $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 (APIRole $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 ($name)
 Loads a role for the given name. 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 (APIRole $role, APIPolicy $policy)
 removes a policy from the role More...
 
 setSession ($id)
 Set session ID. More...
 
 unassignRoleFromUser (APIRole $role, User $user)
 removes a role from the given user. More...
 
 unassignRoleFromUserGroup (APIRole $role, UserGroup $userGroup)
 removes a role from the given user group. More...
 
 updatePolicy (APIPolicy $policy, APIPolicyUpdateStruct $policyUpdateStruct)
 Updates the limitations of a policy. More...
 
 updateRole (APIRole $role, RoleUpdateStruct $roleUpdateStruct)
 Updates the name of the role. More...
 
- Public Member Functions inherited from eZ\Publish\API\Repository\RoleService
 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...
 
 getRoleAssignments (Role $role)
 Returns the assigned user and user groups to this role. 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...
 

Private Attributes

 $client
 
 $inputDispatcher
 
 $outputVisitor
 
 $urlHandler
 
 $userService
 

Detailed Description

Implementation of the eZ\Publish\API\Repository\RoleServiceinterface.

See Also

Constructor & Destructor Documentation

eZ\Publish\Core\REST\Client\RoleService::__construct ( UserService  $userService,
HttpClient  $client,
Dispatcher  $inputDispatcher,
Visitor  $outputVisitor,
UrlHandler  $urlHandler 
)
Parameters
\eZ\Publish\Core\REST\Client\UserService$userService
\eZ\Publish\Core\REST\Client\HttpClient$client
\eZ\Publish\Core\REST\Common\Input\Dispatcher$inputDispatcher
\eZ\Publish\Core\REST\Common\Output\Visitor$outputVisitor
\eZ\Publish\Core\REST\Common\UrlHandler$urlHandler

Member Function Documentation

eZ\Publish\Core\REST\Client\RoleService::addPolicy ( APIRole  $role,
APIPolicyCreateStruct  $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
eZ\Publish\Core\REST\Client\RoleService::assignRoleToUser ( APIRole  $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
Todo:
add limitations
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)
eZ\Publish\Core\REST\Client\RoleService::assignRoleToUserGroup ( APIRole  $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)
eZ\Publish\Core\REST\Client\RoleService::createRole ( APIRoleCreateStruct  $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
eZ\Publish\Core\REST\Client\RoleService::deleteRole ( APIRole  $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
eZ\Publish\Core\REST\Client\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\REST\Client\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\REST\Client\RoleService::getRoleAssignments ( APIRole  $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
[]
eZ\Publish\Core\REST\Client\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\REST\Client\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\REST\Client\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
mixed$userId
Returns
[]

Implements eZ\Publish\API\Repository\RoleService.

eZ\Publish\Core\REST\Client\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.

Referenced by eZ\Publish\Core\REST\Client\RoleService\removePolicy().

eZ\Publish\Core\REST\Client\RoleService::loadRoleByIdentifier (   $name)

Loads a role for the given name.

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$name
Returns

Implements eZ\Publish\API\Repository\RoleService.

eZ\Publish\Core\REST\Client\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\REST\Client\RoleService::newPolicyCreateStruct (   $module,
  $function 
)

Instantiates a policy create class.

Parameters
string$module
string$function
Returns

Implements eZ\Publish\API\Repository\RoleService.

eZ\Publish\Core\REST\Client\RoleService::newPolicyUpdateStruct ( )

Instantiates a policy update class.

Returns

Implements eZ\Publish\API\Repository\RoleService.

eZ\Publish\Core\REST\Client\RoleService::newRoleCreateStruct (   $name)

Instantiates a role create class.

Parameters
string$name
Returns

Implements eZ\Publish\API\Repository\RoleService.

eZ\Publish\Core\REST\Client\RoleService::newRoleUpdateStruct ( )

Instantiates a policy update class.

Returns

Implements eZ\Publish\API\Repository\RoleService.

eZ\Publish\Core\REST\Client\RoleService::removePolicy ( APIRole  $role,
APIPolicy  $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
eZ\Publish\Core\REST\Client\RoleService::setSession (   $id)

Set session ID.

Only for testing

Parameters
mixed$id
Returns
void

Implements eZ\Publish\Core\REST\Client\Sessionable.

eZ\Publish\Core\REST\Client\RoleService::unassignRoleFromUser ( APIRole  $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
eZ\Publish\Core\REST\Client\RoleService::unassignRoleFromUserGroup ( APIRole  $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
eZ\Publish\Core\REST\Client\RoleService::updatePolicy ( APIPolicy  $policy,
APIPolicyUpdateStruct  $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
eZ\Publish\Core\REST\Client\RoleService::updateRole ( APIRole  $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

Member Data Documentation

eZ\Publish\Core\REST\Client\RoleService::$client
private
eZ\Publish\Core\REST\Client\RoleService::$inputDispatcher
private
eZ\Publish\Core\REST\Client\RoleService::$outputVisitor
private
eZ\Publish\Core\REST\Client\RoleService::$urlHandler
private
eZ\Publish\Core\REST\Client\RoleService::$userService
private

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