/** * Delete the given user * * @param User $user * @return void */ public function deleteAction(User $user) { if ($user === $this->currentUser) { $this->addFlashMessage('You can not delete the currently logged in user', 'Current user can\'t be deleted', Message::SEVERITY_WARNING, array(), 1412374546); $this->redirect('index'); } $this->userService->deleteUser($user); $this->addFlashMessage('The user "%s" has been deleted.', 'User deleted', Message::SEVERITY_NOTICE, array(htmlspecialchars($user->getName()->getFullName())), 1412374546); $this->redirect('index'); }
/** * Delete a user * * This command deletes an existing Neos user. All content and data directly related to this user, including but * not limited to draft workspace contents, will be removed as well. * * All accounts owned by the given user will be deleted. * * If an authentication provider is specified, this command will look for an account with the given username related * to the given provider. Specifying an authentication provider does <b>not</b> mean that only the account for that * provider is deleted! If a user was found by the combination of username and authentication provider, <b>all</b> * related accounts will be deleted. * * @param string $username The username of the user to be removed * @param boolean $assumeYes Assume "yes" as the answer to the confirmation dialog * @param string $authenticationProvider Name of the authentication provider to use. Example: "Typo3BackendProvider" * @return void */ public function deleteCommand($username, $assumeYes = false, $authenticationProvider = null) { $user = $this->getUserOrFail($username, $authenticationProvider); if ($assumeYes === true) { $delete = true; } else { $delete = $this->output->askConfirmation(sprintf('Are you sure you want to delete the user "%s" (%s) including all directly related data? (y/n) ', $username, $user->getName())); } if ($delete) { $this->userService->deleteUser($user); $this->outputLine('Deleted user "%s".', array($username)); } }