From 290872a0986e0aa0f6a8316c9c0cdeeda92d19df Mon Sep 17 00:00:00 2001 From: MascoSkray Date: Tue, 25 Apr 2017 12:40:09 +0800 Subject: [PATCH] feat: add an option to set user as superuser Superusers now can easily add user as superuser. BREAKING CHANGE: login into others' account is no longer supported For safety reasons, we removed the option for superusers to login into other users' account. If you want to recover this option, please add the code by yourself. --- uoj/1/app/controllers/super_manage.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/uoj/1/app/controllers/super_manage.php b/uoj/1/app/controllers/super_manage.php index ad282a6..035c43c 100644 --- a/uoj/1/app/controllers/super_manage.php +++ b/uoj/1/app/controllers/super_manage.php @@ -20,9 +20,9 @@ null ); $options = array( - 'ban' => '封禁', - 'deblocking' => '解封', - 'login' => '登录' + 'banneduser' => '设为封禁用户', + 'normaluser' => '设为普通用户', + 'superuser' => '设为超级用户' ); $user_form->addSelect('op-type', $options, '操作类型', ''); $user_form->handle = function() { @@ -30,15 +30,14 @@ $username = $_POST['username']; switch ($_POST['op-type']) { - case 'ban': + case 'banneduser': DB::update("update user_info set usergroup = 'B' where username = '{$username}'"); break; - case 'deblocking': + case 'normaluser': DB::update("update user_info set usergroup = 'U' where username = '{$username}'"); break; - case 'login': - Auth::login($username); - $user_form->succ_href = "/"; + case 'superuser': + DB::update("update user_info set usergroup = 'S' where username = '{$username}'"); break; } };