mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 12:58:40 +00:00
feat: add contest_judger permission
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
ca3680727c
commit
9b8ffca752
@ -99,8 +99,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (isSuperUser($myUser)) {
|
||||
if (CONTEST_PENDING_FINAL_TEST <= $contest['cur_progress'] && $contest['cur_progress'] <= CONTEST_TESTING) {
|
||||
if (isSuperUser($myUser) || isContestJudger($myUser)) {
|
||||
if (CONTEST_PENDING_FINAL_TEST <= $contest['cur_progress']) {
|
||||
$start_test_form = new UOJForm('start_test');
|
||||
$start_test_form->handle = function() {
|
||||
global $contest;
|
||||
|
@ -163,6 +163,7 @@
|
||||
$usertype_options = array(
|
||||
'problem_uploader' => '题目上传者',
|
||||
'problem_manager' => '题目管理员',
|
||||
'contest_judger' => '比赛评测员',
|
||||
'contest_only' => '仅比赛参加者',
|
||||
);
|
||||
$usertype_form->addSelect('usertype_type', $usertype_options, '角色', '');
|
||||
@ -174,6 +175,7 @@
|
||||
switch ($_POST['usertype_type']) {
|
||||
case 'problem_uploader':
|
||||
case 'problem_manager':
|
||||
case 'contest_judger':
|
||||
case 'contest_only':
|
||||
$user = queryUser($username);
|
||||
$user = $_POST['usertype_op'] === 'add'
|
||||
|
@ -165,6 +165,12 @@ function isProblemManager($user) {
|
||||
}
|
||||
return hasUserType($user, 'problem_manager');
|
||||
}
|
||||
function isContestJudger($user) {
|
||||
if ($user == null) {
|
||||
return false;
|
||||
}
|
||||
return hasUserType($user, 'contest_judger');
|
||||
}
|
||||
|
||||
function isSuperUser($user) {
|
||||
return $user != null && $user['usergroup'] == 'S';
|
||||
|
Loading…
Reference in New Issue
Block a user