mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-26 05:08:41 +00:00
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.
This commit is contained in:
parent
39acf1b05e
commit
290872a098
@ -20,9 +20,9 @@
|
|||||||
null
|
null
|
||||||
);
|
);
|
||||||
$options = array(
|
$options = array(
|
||||||
'ban' => '封禁',
|
'banneduser' => '设为封禁用户',
|
||||||
'deblocking' => '解封',
|
'normaluser' => '设为普通用户',
|
||||||
'login' => '登录'
|
'superuser' => '设为超级用户'
|
||||||
);
|
);
|
||||||
$user_form->addSelect('op-type', $options, '操作类型', '');
|
$user_form->addSelect('op-type', $options, '操作类型', '');
|
||||||
$user_form->handle = function() {
|
$user_form->handle = function() {
|
||||||
@ -30,15 +30,14 @@
|
|||||||
|
|
||||||
$username = $_POST['username'];
|
$username = $_POST['username'];
|
||||||
switch ($_POST['op-type']) {
|
switch ($_POST['op-type']) {
|
||||||
case 'ban':
|
case 'banneduser':
|
||||||
DB::update("update user_info set usergroup = 'B' where username = '{$username}'");
|
DB::update("update user_info set usergroup = 'B' where username = '{$username}'");
|
||||||
break;
|
break;
|
||||||
case 'deblocking':
|
case 'normaluser':
|
||||||
DB::update("update user_info set usergroup = 'U' where username = '{$username}'");
|
DB::update("update user_info set usergroup = 'U' where username = '{$username}'");
|
||||||
break;
|
break;
|
||||||
case 'login':
|
case 'superuser':
|
||||||
Auth::login($username);
|
DB::update("update user_info set usergroup = 'S' where username = '{$username}'");
|
||||||
$user_form->succ_href = "/";
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user