Final organizers can see the team information

This commit is contained in:
Yohann D'ANELLO 2020-05-18 23:51:13 +02:00
parent be1957d984
commit 7c89aa62cc
2 changed files with 4 additions and 2 deletions

View File

@ -14,7 +14,7 @@ from django.views.generic import CreateView, UpdateView, DetailView, FormView
from django_tables2 import SingleTableView from django_tables2 import SingleTableView
from tournament.forms import TeamForm, JoinTeam from tournament.forms import TeamForm, JoinTeam
from tournament.models import Team from tournament.models import Team
from tournament.views import AdminMixin, TeamMixin from tournament.views import AdminMixin, TeamMixin, OrgaMixin
from .forms import SignUpForm, TFJMUserForm, AdminUserForm, CoachUserForm from .forms import SignUpForm, TFJMUserForm, AdminUserForm, CoachUserForm
from .models import TFJMUser, Document, Solution, MotivationLetter, Synthesis from .models import TFJMUser, Document, Solution, MotivationLetter, Synthesis
@ -235,7 +235,7 @@ class OrphanedProfileListView(AdminMixin, SingleTableView):
extra_context = dict(title=_("Orphaned profiles"), type="orphaned") extra_context = dict(title=_("Orphaned profiles"), type="orphaned")
class OrganizersListView(AdminMixin, SingleTableView): class OrganizersListView(OrgaMixin, SingleTableView):
""" """
List all organizers. List all organizers.
""" """

View File

@ -156,6 +156,8 @@ class TeamDetailView(LoginRequiredMixin, DetailView):
""" """
if not request.user.is_authenticated or \ if not request.user.is_authenticated or \
(not request.user.admin and self.request.user not in self.get_object().tournament.organizers.all() (not request.user.admin and self.request.user not in self.get_object().tournament.organizers.all()
and not (self.get_object().selected_for_final
and request.user in Tournament.get_final().organizers.all())
and self.get_object() != request.user.team): and self.get_object() != request.user.team):
raise PermissionDenied raise PermissionDenied
return super().dispatch(request, *args, **kwargs) return super().dispatch(request, *args, **kwargs)