From da25480993abf13054e6f3c4fe5eceb164715a6e Mon Sep 17 00:00:00 2001 From: Bartuccio Antoine Date: Wed, 1 May 2019 15:50:03 +0200 Subject: [PATCH] clubs: use standard rights for ClubMailingView --- club/views.py | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/club/views.py b/club/views.py index 7aae48f6..06c8c7f3 100644 --- a/club/views.py +++ b/club/views.py @@ -502,7 +502,7 @@ class ClubStatView(TemplateView): return kwargs -class ClubMailingView(ClubTabsMixin, DetailFormView): +class ClubMailingView(ClubTabsMixin, CanEditMixin, DetailFormView): """ A list of mailing for a given club """ @@ -513,27 +513,13 @@ class ClubMailingView(ClubTabsMixin, DetailFormView): template_name = "club/mailing.jinja" current_tab = "mailing" - def authorized(self): - return ( - self.get_object().has_rights_in_club(self.request.user) - or self.request.user.is_root - or self.request.user.is_in_group(settings.SITH_GROUP_COM_ADMIN_ID) - ) - def get_form_kwargs(self, *args, **kwargs): kwargs = super(ClubMailingView, self).get_form_kwargs(*args, **kwargs) kwargs["club_id"] = self.get_object().id kwargs["user_id"] = self.request.user.id return kwargs - def dispatch(self, request, *args, **kwargs): - res = super(ClubMailingView, self).dispatch(request, *args, **kwargs) - if not self.authorized(): - raise PermissionDenied - return res - def get_context_data(self, **kwargs): - self.object = self.get_object() kwargs = super(ClubMailingView, self).get_context_data(**kwargs) kwargs["club"] = self.get_object() kwargs["user"] = self.request.user