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:
MascoSkray 2017-04-25 12:40:09 +08:00
parent 39acf1b05e
commit 290872a098
No known key found for this signature in database
GPG Key ID: 6ABABD8325167A2E

View File

@ -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;
}
};