From eb31440b7622663cde2fdc9e18e479b85cda4a78 Mon Sep 17 00:00:00 2001 From: Le Bao Hiep Date: Wed, 18 Oct 2023 23:04:25 +0700 Subject: [PATCH] Do not allow aborting submissions in official contest mode --- judge/views/submission.py | 2 +- templates/submission/status.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/judge/views/submission.py b/judge/views/submission.py index 8de7796b0..b70b47d22 100644 --- a/judge/views/submission.py +++ b/judge/views/submission.py @@ -331,7 +331,7 @@ def get(self, request, *args, **kwargs): def abort_submission(request, submission): submission = get_object_or_404(Submission, id=int(submission)) if (not request.user.has_perm('judge.abort_any_submission') and - (submission.rejudged_date is not None or request.profile != submission.user)): + (submission.rejudged_date is not None or request.profile != submission.user or request.official_contest_mode)): raise PermissionDenied() submission.abort() return HttpResponseRedirect(reverse('submission_status', args=(submission.id,))) diff --git a/templates/submission/status.html b/templates/submission/status.html index 44cd0d784..952d28e44 100644 --- a/templates/submission/status.html +++ b/templates/submission/status.html @@ -106,7 +106,7 @@
{% include "submission/status-testcases.html" %}
{% if not submission.is_graded %} - {% if request.user == submission.user.user or perms.judge.abort_any_submission %} + {% if (request.user == submission.user.user and not request.official_contest_mode) or perms.judge.abort_any_submission %}