mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2024-12-05 01:26:54 +00:00
user.is_admin -> user.registration.is_admin
This commit is contained in:
parent
88c4a6b218
commit
0dece5abef
@ -82,7 +82,7 @@ class TeamDetailView(LoginRequiredMixin, DetailView):
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
user = request.user
|
||||
if user.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.pk == kwargs["pk"]:
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
raise PermissionDenied
|
||||
|
||||
@ -94,7 +94,7 @@ class TeamUpdateView(LoginRequiredMixin, UpdateView):
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
user = request.user
|
||||
if user.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.pk == kwargs["pk"]:
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
raise PermissionDenied
|
||||
|
||||
@ -133,7 +133,8 @@ class ParticipationDetailView(LoginRequiredMixin, DetailView):
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
user = request.user
|
||||
if user.is_admin or user.registration.participates and user.registration.team.participation.pk == kwargs["pk"]:
|
||||
if user.registration.is_admin or user.registration.participates\
|
||||
and user.registration.team.participation.pk == kwargs["pk"]:
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
raise PermissionDenied
|
||||
|
||||
@ -145,7 +146,7 @@ class UploadVideoView(LoginRequiredMixin, UpdateView):
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
user = request.user
|
||||
if user.is_admin or user.registration.participates\
|
||||
if user.registration.is_admin or user.registration.participates\
|
||||
and user.registration.team.participation.pk == self.object.participation.pk:
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
raise PermissionDenied
|
||||
|
Loading…
Reference in New Issue
Block a user