PHP Class eZ\Publish\Core\REST\Server\Controller\Role

Inheritance: extends eZ\Publish\Core\REST\Server\Controller
Exibir arquivo Open project: ezsystems/ezpublish-kernel

Protected Properties

Property Type Description
$locationService eZ\Publish\API\Repository\LocationService Location service.
$roleService eZ\Publish\API\Repository\RoleService Role service.
$userService eZ\Publish\API\Repository\UserService User service.

Public Methods

Method Description
__construct ( eZ\Publish\API\Repository\RoleService $roleService, eZ\Publish\API\Repository\UserService $userService, eZ\Publish\API\Repository\LocationService $locationService ) Construct controller.
addPolicy ( $roleId, Request $request ) : CreatedPolicy Adds a policy to role.
addPolicyByRoleDraft ( $roleId, Request $request ) : CreatedPolicy Adds a policy to a role draft.
assignRoleToUser ( $userId, Request $request ) : RoleAssignmentList Assigns role to user.
assignRoleToUserGroup ( $groupPath, Request $request ) : RoleAssignmentList Assigns role to user group.
createRole ( Request $request ) : CreatedRole Create new role.
createRoleDraft ( $roleId, Request $request ) : CreatedRole Creates a new RoleDraft for an existing Role.
deletePolicies ( $roleId ) : eZ\Publish\Core\REST\Server\Values\NoContent Deletes all policies from a role.
deletePolicy ( $roleId, $policyId, Request $request ) : eZ\Publish\Core\REST\Server\Values\NoContent Delete a policy from role.
deleteRole ( $roleId ) : eZ\Publish\Core\REST\Server\Values\NoContent Delete a role by ID.
deleteRoleDraft ( $roleId ) : eZ\Publish\Core\REST\Server\Values\NoContent Delete a role draft by ID.
listPoliciesForUser ( Request $request ) : PolicyList Search all policies which are applied to a given user.
listRoles ( Request $request ) : RoleList Loads list of roles.
loadPolicies ( $roleId, Request $request ) : PolicyList Loads the policies for the role.
loadPolicy ( $roleId, $policyId, Request $request ) : eZ\Publish\API\Repository\Values\User\Policy Loads a policy.
loadRole ( $roleId ) : eZ\Publish\API\Repository\Values\User\Role Loads role.
loadRoleAssignmentForUser ( $userId, $roleId, Request $request ) : RestUserRoleAssignment Returns a role assignment to the given user.
loadRoleAssignmentForUserGroup ( $groupPath, $roleId, Request $request ) : RestUserGroupRoleAssignment Returns a role assignment to the given user group.
loadRoleAssignmentsForUser ( $userId ) : RoleAssignmentList Loads role assignments for user.
loadRoleAssignmentsForUserGroup ( $groupPath ) : RoleAssignmentList Loads role assignments for user group.
loadRoleDraft ( mixed $roleId ) : eZ\Publish\API\Repository\Values\User\RoleDraft Loads a role draft.
publishRoleDraft ( mixed $roleId ) : PublishedRole Publishes a role draft.
removePolicyByRoleDraft ( $roleId, $policyId, Request $request ) : eZ\Publish\Core\REST\Server\Values\NoContent Remove a policy from a role draft.
unassignRoleFromUser ( $userId, $roleId ) : RoleAssignmentList Un-assigns role from user.
unassignRoleFromUserGroup ( $groupPath, $roleId ) : RoleAssignmentList Un-assigns role from user group.
updatePolicy ( $roleId, $policyId, Request $request ) : eZ\Publish\API\Repository\Values\User\Policy Updates a policy.
updatePolicyByRoleDraft ( $roleId, $policyId, Request $request ) : eZ\Publish\API\Repository\Values\User\Policy Updates a policy.
updateRole ( $roleId, Request $request ) : eZ\Publish\API\Repository\Values\User\Role Updates a role.
updateRoleDraft ( mixed $roleId, Request $request ) : eZ\Publish\API\Repository\Values\User\RoleDraft Updates a role draft.

Protected Methods

Method Description
mapToUpdateStruct ( eZ\Publish\API\Repository\Values\User\RoleCreateStruct $createStruct ) : eZ\Publish\API\Repository\Values\User\RoleUpdateStruct Maps a RoleCreateStruct to a RoleUpdateStruct.

Private Methods

Method Description
getLastAddedPolicy ( $role ) : eZ\Publish\API\Repository\Values\User\Policy Get the last added policy for $role.

Method Details

__construct() public method

Construct controller.
public __construct ( eZ\Publish\API\Repository\RoleService $roleService, eZ\Publish\API\Repository\UserService $userService, eZ\Publish\API\Repository\LocationService $locationService )
$roleService eZ\Publish\API\Repository\RoleService
$userService eZ\Publish\API\Repository\UserService
$locationService eZ\Publish\API\Repository\LocationService

addPolicy() public method

Adds a policy to role.
public addPolicy ( $roleId, Request $request ) : CreatedPolicy
$roleId int ID of a role or a role draft
$request Symfony\Component\HttpFoundation\Request
return eZ\Publish\Core\REST\Server\Values\CreatedPolicy

addPolicyByRoleDraft() public method

Adds a policy to a role draft.
Deprecation: since 6.3, use {@see \addPolicy}
Since: 6.2
public addPolicyByRoleDraft ( $roleId, Request $request ) : CreatedPolicy
$roleId
$request Symfony\Component\HttpFoundation\Request
return eZ\Publish\Core\REST\Server\Values\CreatedPolicy

assignRoleToUser() public method

Assigns role to user.
public assignRoleToUser ( $userId, Request $request ) : RoleAssignmentList
$userId
$request Symfony\Component\HttpFoundation\Request
return eZ\Publish\Core\REST\Server\Values\RoleAssignmentList

assignRoleToUserGroup() public method

Assigns role to user group.
public assignRoleToUserGroup ( $groupPath, Request $request ) : RoleAssignmentList
$groupPath
$request Symfony\Component\HttpFoundation\Request
return eZ\Publish\Core\REST\Server\Values\RoleAssignmentList

createRole() public method

Defaults to publishing the role, but you can create a draft instead by setting the POST parameter publish=false
public createRole ( Request $request ) : CreatedRole
$request Symfony\Component\HttpFoundation\Request
return eZ\Publish\Core\REST\Server\Values\CreatedRole

createRoleDraft() public method

Creates a new RoleDraft for an existing Role.
Since: 6.2
public createRoleDraft ( $roleId, Request $request ) : CreatedRole
$request Symfony\Component\HttpFoundation\Request
return eZ\Publish\Core\REST\Server\Values\CreatedRole

deletePolicies() public method

Deletes all policies from a role.
public deletePolicies ( $roleId ) : eZ\Publish\Core\REST\Server\Values\NoContent
$roleId
return eZ\Publish\Core\REST\Server\Values\NoContent

deletePolicy() public method

Delete a policy from role.
public deletePolicy ( $roleId, $policyId, Request $request ) : eZ\Publish\Core\REST\Server\Values\NoContent
$roleId int ID of a role or a role draft
$policyId int ID of a policy
$request Symfony\Component\HttpFoundation\Request
return eZ\Publish\Core\REST\Server\Values\NoContent

deleteRole() public method

Delete a role by ID.
public deleteRole ( $roleId ) : eZ\Publish\Core\REST\Server\Values\NoContent
$roleId
return eZ\Publish\Core\REST\Server\Values\NoContent

deleteRoleDraft() public method

Delete a role draft by ID.
Since: 6.2
public deleteRoleDraft ( $roleId ) : eZ\Publish\Core\REST\Server\Values\NoContent
$roleId
return eZ\Publish\Core\REST\Server\Values\NoContent

listPoliciesForUser() public method

Search all policies which are applied to a given user.
public listPoliciesForUser ( Request $request ) : PolicyList
$request Symfony\Component\HttpFoundation\Request
return eZ\Publish\Core\REST\Server\Values\PolicyList

listRoles() public method

Loads list of roles.
public listRoles ( Request $request ) : RoleList
$request Symfony\Component\HttpFoundation\Request
return eZ\Publish\Core\REST\Server\Values\RoleList

loadPolicies() public method

Loads the policies for the role.
public loadPolicies ( $roleId, Request $request ) : PolicyList
$roleId
$request Symfony\Component\HttpFoundation\Request
return eZ\Publish\Core\REST\Server\Values\PolicyList

loadPolicy() public method

Loads a policy.
public loadPolicy ( $roleId, $policyId, Request $request ) : eZ\Publish\API\Repository\Values\User\Policy
$roleId
$policyId
$request Symfony\Component\HttpFoundation\Request
return eZ\Publish\API\Repository\Values\User\Policy

loadRole() public method

Loads role.
public loadRole ( $roleId ) : eZ\Publish\API\Repository\Values\User\Role
$roleId
return eZ\Publish\API\Repository\Values\User\Role

loadRoleAssignmentForUser() public method

Returns a role assignment to the given user.
public loadRoleAssignmentForUser ( $userId, $roleId, Request $request ) : RestUserRoleAssignment
$userId
$roleId
$request Symfony\Component\HttpFoundation\Request
return eZ\Publish\Core\REST\Server\Values\RestUserRoleAssignment

loadRoleAssignmentForUserGroup() public method

Returns a role assignment to the given user group.
public loadRoleAssignmentForUserGroup ( $groupPath, $roleId, Request $request ) : RestUserGroupRoleAssignment
$groupPath
$roleId
$request Symfony\Component\HttpFoundation\Request
return eZ\Publish\Core\REST\Server\Values\RestUserGroupRoleAssignment

loadRoleAssignmentsForUser() public method

Loads role assignments for user.
public loadRoleAssignmentsForUser ( $userId ) : RoleAssignmentList
$userId
return eZ\Publish\Core\REST\Server\Values\RoleAssignmentList

loadRoleAssignmentsForUserGroup() public method

Loads role assignments for user group.
public loadRoleAssignmentsForUserGroup ( $groupPath ) : RoleAssignmentList
$groupPath
return eZ\Publish\Core\REST\Server\Values\RoleAssignmentList

loadRoleDraft() public method

Loads a role draft.
public loadRoleDraft ( mixed $roleId ) : eZ\Publish\API\Repository\Values\User\RoleDraft
$roleId mixed Original role ID, or ID of the role draft itself
return eZ\Publish\API\Repository\Values\User\RoleDraft

mapToUpdateStruct() protected method

Needed since both structs are encoded into the same media type on input.
protected mapToUpdateStruct ( eZ\Publish\API\Repository\Values\User\RoleCreateStruct $createStruct ) : eZ\Publish\API\Repository\Values\User\RoleUpdateStruct
$createStruct eZ\Publish\API\Repository\Values\User\RoleCreateStruct
return eZ\Publish\API\Repository\Values\User\RoleUpdateStruct

publishRoleDraft() public method

Publishes a role draft.
public publishRoleDraft ( mixed $roleId ) : PublishedRole
$roleId mixed Original role ID, or ID of the role draft itself
return eZ\Publish\Core\REST\Server\Values\PublishedRole

removePolicyByRoleDraft() public method

Remove a policy from a role draft.
Deprecation: since 6.3, use {@see \deletePolicy}
Since: 6.2
public removePolicyByRoleDraft ( $roleId, $policyId, Request $request ) : eZ\Publish\Core\REST\Server\Values\NoContent
$roleId
$policyId
$request Symfony\Component\HttpFoundation\Request
return eZ\Publish\Core\REST\Server\Values\NoContent

unassignRoleFromUser() public method

Un-assigns role from user.
public unassignRoleFromUser ( $userId, $roleId ) : RoleAssignmentList
$userId
$roleId
return eZ\Publish\Core\REST\Server\Values\RoleAssignmentList

unassignRoleFromUserGroup() public method

Un-assigns role from user group.
public unassignRoleFromUserGroup ( $groupPath, $roleId ) : RoleAssignmentList
$groupPath
$roleId
return eZ\Publish\Core\REST\Server\Values\RoleAssignmentList

updatePolicy() public method

Updates a policy.
public updatePolicy ( $roleId, $policyId, Request $request ) : eZ\Publish\API\Repository\Values\User\Policy
$roleId int ID of a role or a role draft
$policyId int ID of a policy
$request Symfony\Component\HttpFoundation\Request
return eZ\Publish\API\Repository\Values\User\Policy

updatePolicyByRoleDraft() public method

Updates a policy.
Deprecation: since 6.3, use {@see \updatePolicy}
Since: 6.2
public updatePolicyByRoleDraft ( $roleId, $policyId, Request $request ) : eZ\Publish\API\Repository\Values\User\Policy
$roleId
$policyId
$request Symfony\Component\HttpFoundation\Request
return eZ\Publish\API\Repository\Values\User\Policy

updateRole() public method

Updates a role.
public updateRole ( $roleId, Request $request ) : eZ\Publish\API\Repository\Values\User\Role
$roleId
$request Symfony\Component\HttpFoundation\Request
return eZ\Publish\API\Repository\Values\User\Role

updateRoleDraft() public method

Updates a role draft.
public updateRoleDraft ( mixed $roleId, Request $request ) : eZ\Publish\API\Repository\Values\User\RoleDraft
$roleId mixed Original role ID, or ID of the role draft itself
$request Symfony\Component\HttpFoundation\Request
return eZ\Publish\API\Repository\Values\User\RoleDraft

Property Details

$locationService protected_oe property

Location service.
protected LocationService,eZ\Publish\API\Repository $locationService
return eZ\Publish\API\Repository\LocationService

$roleService protected_oe property

Role service.
protected RoleService,eZ\Publish\API\Repository $roleService
return eZ\Publish\API\Repository\RoleService

$userService protected_oe property

User service.
protected UserService,eZ\Publish\API\Repository $userService
return eZ\Publish\API\Repository\UserService