mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-12-23 10:11:54 +00:00
fix(web/submissions): submission_list view 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
34ce6fd556
commit
4018227d8b
@ -467,9 +467,9 @@ function echoSubmissionsList($cond, $tail, $config, $user) {
|
||||
|
||||
$table_name = isset($config['table_name']) ? $config['table_name'] : 'submissions';
|
||||
|
||||
if (!isSuperUser($user)) {
|
||||
if (!isProblemManager($user)) {
|
||||
if ($user != null) {
|
||||
$permission_cond = "submissions.is_hidden = false or (submissions.is_hidden = true and submissions.problem_id in (select problem_id from problems_permissions where username = '{$user['username']}'))";
|
||||
$permission_cond = "submissions.is_hidden = false or submissions.submitter = '{$user['username']}' or (submissions.is_hidden = true and (submissions.problem_id in (select problem_id from problems_permissions where username = '{$user['username']}') or submissions.problem_id in (select id from problems where uploader = '{$user['username']}')))";
|
||||
} else {
|
||||
$permission_cond = "submissions.is_hidden = false";
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ function isContestProblemVisibleToUser($problem, $contest, $user) {
|
||||
}
|
||||
|
||||
function isSubmissionVisibleToUser($submission, $problem, $user) {
|
||||
if (isSuperUser($user)) {
|
||||
if (isProblemManager($user)) {
|
||||
return true;
|
||||
} elseif (!$submission['is_hidden']) {
|
||||
return true;
|
||||
|
@ -163,6 +163,9 @@ function isProblemManager($user) {
|
||||
if ($user == null) {
|
||||
return false;
|
||||
}
|
||||
if (isSuperUser($user)) {
|
||||
return true;
|
||||
}
|
||||
return hasUserType($user, 'problem_manager');
|
||||
}
|
||||
function isContestJudger($user) {
|
||||
|
Loading…
Reference in New Issue
Block a user