mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-10 11:59:23 +00:00
Move mailing list admin to com
This commit is contained in:
@ -237,7 +237,7 @@ class Mailing(models.Model):
|
||||
super(Mailing, self).clean()
|
||||
|
||||
def is_owned_by(self, user):
|
||||
return user.is_in_group(self) or user.is_root or user.is_board_member
|
||||
return user.is_in_group(self) or user.is_root or user.is_in_group(settings.SITH_GROUP_COM_ADMIN_ID)
|
||||
|
||||
def can_view(self, user):
|
||||
return self.club.has_rights_in_club(user)
|
||||
@ -281,10 +281,10 @@ class MailingSubscription(models.Model):
|
||||
super(MailingSubscription, self).clean()
|
||||
|
||||
def is_owned_by(self, user):
|
||||
return self.mailing.club.has_rights_in_club(user) or user.is_root
|
||||
return self.mailing.club.has_rights_in_club(user) or user.is_root or self.user.is_in_group(settings.SITH_GROUP_COM_ADMIN_ID)
|
||||
|
||||
def can_be_edited_by(self, user):
|
||||
return self.is_owned_by(user) or (user is not None and user.id == self.user.id)
|
||||
return (user is not None and user.id == self.user.id)
|
||||
|
||||
def fetch_format(self):
|
||||
return self.email + ' '
|
||||
|
@ -7,6 +7,8 @@
|
||||
{% block content %}
|
||||
{% if has_objects %}
|
||||
|
||||
{% trans %}Remember : mailing lists need to be validated by the school to work, please inform us about any new mailing list created{% endtrans %}
|
||||
|
||||
{% for mailing in object_list %}
|
||||
<h2>{% trans %}Mailing{% endtrans %} {{ mailing.email }}
|
||||
{%- if user.is_owner(mailing) -%}
|
||||
|
@ -24,9 +24,8 @@
|
||||
#
|
||||
|
||||
from django import forms
|
||||
from enum import Enum
|
||||
from django.views.generic import ListView, DetailView, TemplateView
|
||||
from django.views.generic.edit import DeleteView, FormView
|
||||
from django.views.generic.edit import DeleteView
|
||||
from django.views.generic.detail import SingleObjectMixin
|
||||
from django.views.generic.edit import UpdateView, CreateView
|
||||
from django.http import HttpResponseRedirect, HttpResponse
|
||||
@ -38,7 +37,7 @@ from ajax_select.fields import AutoCompleteSelectField
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.shortcuts import get_object_or_404
|
||||
|
||||
from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin, TabedViewMixin, CanCreateMixin
|
||||
from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin, TabedViewMixin
|
||||
from core.views.forms import SelectDate, SelectDateTime
|
||||
from club.models import Club, Membership, Mailing, MailingSubscription
|
||||
from sith.settings import SITH_MAXIMUM_FREE_ROLE
|
||||
@ -394,7 +393,7 @@ class ClubMailingView(ClubTabsMixin, ListView):
|
||||
current_tab = 'mailing'
|
||||
|
||||
def authorized(self):
|
||||
return self.club.has_rights_in_club(self.user) or self.user.is_root or self.user.is_board_member
|
||||
return self.club.has_rights_in_club(self.user) or self.user.is_root or self.user.is_in_group(settings.SITH_GROUP_COM_ADMIN_ID)
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
self.club = get_object_or_404(Club, pk=kwargs['club_id'])
|
||||
|
Reference in New Issue
Block a user