1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-07-08 20:50:19 +02:00

Test forbidden accesses

This commit is contained in:
Yohann D'ANELLO
2020-11-02 18:19:53 +01:00
parent 4c25ae2928
commit 25756fb2ef
2 changed files with 33 additions and 1 deletions

View File

@ -241,7 +241,9 @@ class TeamUpdateView(LoginRequiredMixin, UpdateView):
def dispatch(self, request, *args, **kwargs):
user = request.user
if user.registration.is_admin or user.registration.participates and user.registration.team.pk == kwargs["pk"]:
if user.registration.is_admin or user.registration.participates and \
user.registration.team and \
user.registration.team.pk == kwargs["pk"]:
return super().dispatch(request, *args, **kwargs)
raise PermissionDenied