1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-08-21 09:28:41 +02:00

Don't access to team participation if the team is not validated

This commit is contained in:
Yohann D'ANELLO
2020-10-11 16:00:43 +02:00
parent 6e8b6fbc66
commit 552ea17f7d
4 changed files with 101 additions and 76 deletions

View File

@@ -170,6 +170,8 @@ class ParticipationDetailView(LoginRequiredMixin, DetailView):
def dispatch(self, request, *args, **kwargs):
user = request.user
if not self.get_object().valid:
raise PermissionDenied(_("The team is not validated yet."))
if user.registration.is_admin or user.registration.participates\
and user.registration.team.participation.pk == kwargs["pk"]:
return super().dispatch(request, *args, **kwargs)