Fixed access permissions for mass subscriptions
1 parent c5dc9c0 commit f115a87cfa67dccb634d24bd0bd7e6c36aceadd8
@Bhavesh Goyal Bhavesh Goyal authored on 13 Apr 2015
Showing 2 changed files
View
2
■■■
src/postorius/templates/postorius/menu/list_nav.html
{% endif %}
{% if user.is_superuser or user.is_list_owner %}
<li class="mm_nav_item"><a class="{% nav_active_class current 'list_settings' %}" href="{% url 'list_settings' list.list_id %}">{% trans "Settings" %}</a></li>
{% endif %}
{% if user.is_superuser or user.is_list_owner or user.is_list_moderator %}
{% if user.is_superuser or user.is_list_owner %}
<li class="mm_nav_item"><a class="{% nav_active_class current 'mass_subscribe' %}" href="{% url 'mass_subscribe' list.list_id %}">{% trans "Mass Subscribe" %}</a></li>
{% endif %}
{% if user.is_superuser or user.is_list_owner %}
<li class="mm_nav_item"><a class="{% nav_active_class current 'list_delete' %}" href="{% url 'list_delete' list.list_id %}">{% trans "Delete List" %}</a></li>
View
35
src/postorius/views/list.py
from django.contrib import messages
from django.contrib.auth.decorators import (login_required,
user_passes_test)
from django.core.urlresolvers import reverse
from django.core.validators import validate_email
from django.core.exceptions import ValidationError
from django.shortcuts import render_to_response, redirect
from django.template import RequestContext
from django.utils.decorators import method_decorator
from django.utils.translation import gettext as _
messages.error(request, 'Please fill out the form correctly.')
else:
emails = request.POST["emails"].splitlines()
for email in emails:
parts = email.split('@')
if len(parts) != 2 or '.' not in parts[1]:
try:
validate_email(email)
self.mailing_list.subscribe(address=email)
messages.success(request,
'The address %s has been subscribed to %s.' %
(email, self.mailing_list.fqdn_listname))
except MailmanApiError:
return utils.render_api_error(request)
except HTTPError, e:
messages.error(request, e)
except ValidationError:
messages.error(request,
'The email address %s is not valid.' %
email)
else:
try:
self.mailing_list.subscribe(address=email)
messages.success(
request,
'The address %s has been subscribed to %s.' %
(email, self.mailing_list.fqdn_listname))
except MailmanApiError:
return utils.render_api_error(request)
except HTTPError, e:
messages.error(request, e)
return redirect('mass_subscribe', self.mailing_list.list_id)
 
 
def _get_choosable_domains(request):