1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-21 13:18:25 +02:00

Update permissions for juries presidents

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello
2024-03-24 17:42:09 +01:00
parent 0b9079b431
commit d2c1a826a8
4 changed files with 83 additions and 38 deletions

View File

@ -797,9 +797,10 @@ class SolutionView(LoginRequiredMixin, View):
else:
passage_participant_qs = Passage.objects.none()
if not (user.registration.is_admin
or user.registration.is_volunteer and user.registration
in (solution.participation.tournament
if not solution.final_solution else Tournament.final_tournament()).organizers.all()
or (user.registration.is_volunteer
and user.registration in solution.tournament.organizers.all())
or (user.registration.is_volunteer
and user.registration.presided_pools.filter(tournament=solution.tournament).exists())
or user.registration.is_volunteer
and Passage.objects.filter(Q(pool__juries=user.registration)
| Q(pool__tournament__in=user.registration.organized_tournaments.all()),
@ -834,7 +835,8 @@ class SynthesisView(LoginRequiredMixin, View):
user = request.user
if not (user.registration.is_admin or user.registration.is_volunteer
and (user.registration in synthesis.passage.pool.juries.all()
or user.registration in synthesis.passage.pool.tournament.organizers.all())
or user.registration in synthesis.passage.pool.tournament.organizers.all()
or user.registration.presided_pools.filter(tournament=synthesis.passage.pool.tournament).exists())
or user.registration.participates and user.registration.team == synthesis.participation.team):
raise PermissionDenied
# Guess mime type of the file