/** * Admin account delete * * @access public * @params integer * @return Response */ public function action_delete($id = null) { \Util_security::check_method('POST'); \Util_security::check_csrf(); if (check_original_user($id, true)) { throw new \HttpForbiddenException(); } $user = Model_AdminUser::check_authority($id); try { $auth = \Auth::instance(); \DB::start_transaction(); $auth->delete_user($user->username); \DB::commit_transaction(); \Session::set_flash('message', term('admin.user.view') . 'を削除しました。'); } catch (\FuelException $e) { if (\DB::in_transaction()) { \DB::rollback_transaction(); } \Session::set_flash('error', $e->getMessage()); } \Response::redirect(\Site_Util::get_redirect_uri('admin/account')); }
protected function get_current_user($user_id) { return Model_AdminUser::query()->where('id', $user_id)->get_one(); }