Allow contest host to view submissions
This commit is contained in:
parent
f095729cb6
commit
1dfc6d312d
2 changed files with 9 additions and 0 deletions
|
@ -18,4 +18,9 @@ def submission_layout(submission, profile_id, user, editable_problem_ids, comple
|
||||||
if submission.problem_id in completed_problem_ids:
|
if submission.problem_id in completed_problem_ids:
|
||||||
can_view |= submission.problem.is_public or profile_id in submission.problem.tester_ids
|
can_view |= submission.problem.is_public or profile_id in submission.problem.tester_ids
|
||||||
|
|
||||||
|
if not can_view and hasattr(submission, 'contest'):
|
||||||
|
contest = submission.contest.participation.contest
|
||||||
|
if contest.is_editable_by(user):
|
||||||
|
can_view = True
|
||||||
|
|
||||||
return can_view
|
return can_view
|
||||||
|
|
|
@ -77,6 +77,10 @@ class SubmissionDetailBase(LoginRequiredMixin, TitleMixin, SubmissionMixin, Deta
|
||||||
if Submission.objects.filter(user_id=profile.id, result='AC', problem_id=problem.id,
|
if Submission.objects.filter(user_id=profile.id, result='AC', problem_id=problem.id,
|
||||||
points=problem.points).exists():
|
points=problem.points).exists():
|
||||||
return submission
|
return submission
|
||||||
|
if (hasattr(submission, 'contest') and
|
||||||
|
submission.contest.participation.contest.is_editable_by(self.request.user)):
|
||||||
|
return submission
|
||||||
|
|
||||||
raise PermissionDenied()
|
raise PermissionDenied()
|
||||||
|
|
||||||
def get_title(self):
|
def get_title(self):
|
||||||
|
|
Loading…
Reference in a new issue