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

Fix permissions for final tournament

This commit is contained in:
2021-05-11 16:40:18 +02:00
parent 9a1006b341
commit ba6a6338f5
2 changed files with 15 additions and 5 deletions

View File

@ -242,7 +242,9 @@ class UserDetailView(LoginRequiredMixin, DetailView):
user = self.get_object()
if user == me or me.registration.is_admin or me.registration.is_volunteer \
and user.registration.participates and user.registration.team \
and user.registration.team.participation.tournament in me.registration.organized_tournaments.all() \
and (user.registration.team.participation.tournament in me.registration.organized_tournaments.all()
or user.registration.team.participation.final
and Tournament.final_tournament() in me.registration.organized_tournaments.all()) \
or user.registration.is_volunteer and me.registration.is_volunteer \
and me.registration.interesting_tournaments.intersection(user.registration.interesting_tournaments):
return super().dispatch(request, *args, **kwargs)