Esempio n. 1
0
 public function removeRole(SubmitButton $button)
 {
     if (!$this->authorizator->isAllowed($this->user, 'user', 'remove')) {
         $this->flashMessage('authorization.noPermission', FlashMessage::WARNING);
         $this->redirect('this');
     }
     try {
         $this->userFacade->removeUser($this->pickedUser);
         $this->onSuccessUserRemoval($this->pickedUser);
     } catch (ForeignKeyConstraintViolationException $e) {
         $this->flashMessage('users.userRemoval.messages.cantBeRemoved', FlashMessage::WARNING, ['username' => $this->pickedUser->getUsername()]);
         $this->redirect('this');
     }
 }