mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2024-12-24 17:42:23 +00:00
Final organizers can see more things
This commit is contained in:
parent
7c89aa62cc
commit
d3412f3963
@ -13,7 +13,7 @@ from django.views import View
|
||||
from django.views.generic import CreateView, UpdateView, DetailView, FormView
|
||||
from django_tables2 import SingleTableView
|
||||
from tournament.forms import TeamForm, JoinTeam
|
||||
from tournament.models import Team
|
||||
from tournament.models import Team, Tournament
|
||||
from tournament.views import AdminMixin, TeamMixin, OrgaMixin
|
||||
|
||||
from .forms import SignUpForm, TFJMUserForm, AdminUserForm, CoachUserForm
|
||||
@ -66,6 +66,8 @@ class UserDetailView(LoginRequiredMixin, DetailView):
|
||||
|
||||
if not request.user.admin \
|
||||
and (self.object.team is not None and request.user not in self.object.team.tournament.organizers.all())\
|
||||
and (self.object.team is not None and self.object.team.selected_for_final
|
||||
and request.user not in Tournament.get_final().organizers.all())\
|
||||
and self.request.user != self.object:
|
||||
raise PermissionDenied
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
@ -192,6 +194,7 @@ class DocumentView(LoginRequiredMixin, View):
|
||||
|
||||
if isinstance(doc, Solution) or isinstance(doc, Synthesis) or isinstance(doc, MotivationLetter):
|
||||
grant = grant or doc.team == request.user.team or request.user in doc.team.tournament.organizers.all()
|
||||
grant = grant or (doc.team.selected_for_final and request.user in Tournament.get_final().organizers.all())
|
||||
|
||||
if isinstance(doc, Synthesis) and request.user.organizes:
|
||||
grant = True
|
||||
|
Loading…
Reference in New Issue
Block a user