/**
  * 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
 /**
  * Removes the given role assignment.
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to remove a role assignment
  *
  * @param \eZ\Publish\API\Repository\Values\User\RoleAssignment $roleAssignment
  */
 public function removeRoleAssignment(RoleAssignment $roleAssignment)
 {
     $returnValue = $this->service->removeRoleAssignment($roleAssignment);
     $this->signalDispatcher->emit(new RemoveRoleAssignmentSignal(['roleAssignmentId' => $roleAssignment->id]));
     return $returnValue;
 }