/**
  * Deletes a role assignment.
  *
  * @param Request $request
  * @param int $roleAssignmentId Role assignment ID
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function deleteRoleAssignmentAction(Request $request, $roleAssignmentId)
 {
     $roleAssignment = $this->roleService->loadRoleAssignment($roleAssignmentId);
     $deleteForm = $this->createForm(new RoleAssignmentDeleteType(), ['assignmentId' => $roleAssignmentId]);
     $deleteForm->handleRequest($request);
     if ($deleteForm->isValid()) {
         $this->roleService->removeRoleAssignment($roleAssignment);
         $this->notify('role.assignment.deleted', [], 'role');
     } elseif ($deleteForm->isSubmitted()) {
         $this->notifyError('role.assignment.error.delete', [], 'role');
     }
     return $this->redirectToRouteAfterFormPost('admin_roleView', ['roleId' => $roleAssignment->role->id]);
 }
Esempio n. 2
0
 /**
  * Loads a role assignment for the given id.
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to read this role
  * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If the role assignment was not found
  *
  * @param mixed $roleAssignmentId
  *
  * @return \eZ\Publish\API\Repository\Values\User\RoleAssignment
  */
 public function loadRoleAssignment($roleAssignmentId)
 {
     return $this->service->loadRoleAssignment($roleAssignmentId);
 }