Skip to content

Commit

Permalink
Do not allow aborting submissions in official contest mode
Browse files Browse the repository at this point in the history
  • Loading branch information
hieplpvip committed Oct 18, 2023
1 parent 2d2224a commit eb31440
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion judge/views/submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,)))
Expand Down
2 changes: 1 addition & 1 deletion templates/submission/status.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
<div id="test-cases">{% include "submission/status-testcases.html" %}</div>

{% 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 %}
<div id="abort-button">
<br>
<hr class="half-hr">
Expand Down

0 comments on commit eb31440

Please sign in to comment.