Must be authenticated to upload notes

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello 2023-04-10 10:05:14 +02:00
parent 3d7a39a593
commit 80f0baac1e
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
1 changed files with 4 additions and 3 deletions

View File

@ -797,9 +797,10 @@ class PoolUploadNotesView(VolunteerMixin, FormView, DetailView):
def dispatch(self, request, *args, **kwargs):
self.object = self.get_object()
if request.user.registration.is_admin or request.user.registration.is_volunteer \
and (self.object.tournament in request.user.registration.organized_tournaments.all()
or request.user.registration in self.object.juries.all()):
if request.user.is_authenticated and \
(request.user.registration.is_admin or request.user.registration.is_volunteer
and (self.object.tournament in request.user.registration.organized_tournaments.all()
or request.user.registration in self.object.juries.all())):
return super().dispatch(request, *args, **kwargs)
return self.handle_no_permission()