/** * Delete a user. */ public function delete($userId) { $this->requireAdmin(); $user = $this->userStore->getById($userId); if (empty($user)) { throw new NotFoundException(Lang::get('user_n_not_found', $userId)); } $this->userService->deleteUser($user); header('Location: ' . PHPCI_URL . 'user'); die; }
/** * Delete a user. */ public function delete($userId) { $this->requireAdmin(); $user = $this->userStore->getById($userId); if (empty($user)) { throw new NotFoundException(Lang::get('user_n_not_found', $userId)); } $this->userService->deleteUser($user); $response = new b8\Http\Response\RedirectResponse(); $response->setHeader('Location', PHPCI_URL . 'user'); return $response; }
/** * Delete a user. */ public function delete($userId) { if (!$_SESSION['user']->getIsAdmin()) { throw new ForbiddenException('You do not have permission to do that.'); } $user = $this->userStore->getById($userId); if (empty($user)) { throw new NotFoundException('User with ID: ' . $userId . ' does not exist.'); } $this->userService->deleteUser($user); header('Location: ' . PHPCI_URL . 'user'); die; }