Fix permission to view user detail

This commit is contained in:
Yohann D'ANELLO 2021-01-29 10:24:00 +01:00
parent 55c3a5fcc8
commit a6000aec2a
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
1 changed files with 1 additions and 1 deletions

View File

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