Abhilash Raj has proposed merging lp:~raj-abhilash1/postorius/master into
lp:postorius.
Requested reviews:
Mailman Coders (mailman-coders)
For more details, see:
https://code.launchpad.net/~raj-abhilash1/postorius/master/+merge/187104
* Added a few options for list's signature like creating keys, setting
'signature_max_age'
* User can now import his public key from keyservers, or submit his public key
data.
--
https://code.launchpad.net/~raj-abhilash1/postorius/master/+merge/187104
Your team Mailman Coders is requested to review the proposed merge of
lp:~raj-abhilash1/postorius/master into lp:postorius.
=== modified file 'src/postorius/forms.py'
--- src/postorius/forms.py 2013-03-21 18:43:28 +0000
+++ src/postorius/forms.py 2013-09-23 20:31:56 +0000
@@ -459,6 +459,10 @@
# label=_('Posting Address'),
# required=False)
+ # max allowed age of the signature
+ signature_max_age = forms.DecimalField(
+ label=_('Signature age threshold'),
+ help_text=('Max age of signature fit for posting'))
#Descriptions used in the Settings Overview Page
section_descriptions = {
@@ -467,8 +471,10 @@
"Alter Messages": _("Settings that modify member messages"),
"Digest": _("Digest-related options"),
"Message Acceptance": _("Options related to accepting messages"),
- "Archives": _("Options related to archiving messages")}
+ "Archives": _("Options related to archiving messages"),
+ "Signature": _("Options for the signing and verification of signatures"),}
+
def clean_acceptable_aliases(self):
data = self.cleaned_data['acceptable_aliases']
return data.splitlines()
@@ -543,6 +549,7 @@
["Message Acceptance", "acceptable_aliases", "administrivia",
"default_nonmember_action", "default_member_action"],
["Archives", "archive_policy"],
+ ["Signature", "signature_max_age"],
]
=== modified file 'src/postorius/templates/postorius/lists/summary.html'
--- src/postorius/templates/postorius/lists/summary.html 2013-05-31 02:21:03 +0000
+++ src/postorius/templates/postorius/lists/summary.html 2013-09-23 20:31:56 +0000
@@ -6,7 +6,7 @@
{% block body_class %}list_summary{% endblock %}
{% block main %}
- {% if user.is_superuser %}
+ {% if user.is_superuser or user.is_list_owner %}
{% include 'postorius/menu/list_nav.html' %}
{% endif %}
<h1>{{list.display_name}}</h1>
@@ -14,7 +14,23 @@
<h2>{% trans 'Description' %}</h2>
<p>{{list.settings.description }}</p>
-
+
+ <h2>{% trans 'Public Key' %}</h2>
+ <p>{% if not list.public_key %}</p>
+ {% if user.is_superuser or user.is_list_owner %}
+ <div class='error'>
+ No list's keys were found!
+ </div>
+ <form action="{% url 'create_keys' list.fqdn_listname %}" method="post">
+ {% csrf_token %}
+ <input type="submit" class="btn btn-success" value="{% trans 'Create Keys' %}">
+ </form>
+ {% endif %}
+ {% else %}
+ {{ list.public_key | linebreaks}}
+ {% endif %}
+ </p>
+
<h2>{% trans 'Subscribe to this list' %}</h2>
{% if user.is_authenticated %}
<form action="{% url 'list_subscribe' list.fqdn_listname %}" method="post" class="list_subscribe"> {% csrf_token %}
=== modified file 'src/postorius/templates/postorius/menu/user_nav.html'
--- src/postorius/templates/postorius/menu/user_nav.html 2013-03-19 23:58:42 +0000
+++ src/postorius/templates/postorius/menu/user_nav.html 2013-09-23 20:31:56 +0000
@@ -5,8 +5,25 @@
<h1>{% trans "Settings" %}</h1>
</div>
<ul class="mm_nav">
- <li class="mm_nav_item"><a href="{% url 'user_profile' %}">{% trans "Profile" %}</a></li>
- <li class="mm_nav_item"><a href="{% url 'user_mailmansettings' %}">{% trans "Subscription Settings" %}</a></li>
- <li class="mm_nav_item"><a href="{% url 'user_subscriptions' %}">{% trans "Subscriptions" %}</a></li>
+ <li class="mm_nav_item">
+ <a href="{% url 'user_profile' %}">
+ {% trans "Profile" %}
+ </a>
+ </li>
+ <li class="mm_nav_item">
+ <a href="{% url 'user_mailmansettings' %}">
+ {% trans "Subscription Settings" %}
+ </a>
+ </li>
+ <li class="mm_nav_item">
+ <a href="{% url 'user_subscriptions' %}">
+ {% trans "Subscriptions" %}
+ </a>
+ </li>
+ <li class="mm_nav_item">
+ <a href="{% url 'user_gpgsettings' %}">
+ {% trans "GPG" %}
+ </a>
+</li>
</ul>
</div>
=== added file 'src/postorius/templates/postorius/user_gpgsettings.html'
--- src/postorius/templates/postorius/user_gpgsettings.html 1970-01-01 00:00:00 +0000
+++ src/postorius/templates/postorius/user_gpgsettings.html 2013-09-23 20:31:56 +0000
@@ -0,0 +1,30 @@
+{% extends postorius_base_template %}
+{% load url from future %}
+{% load i18n %}
+
+{% block main %}
+ {% include 'postorius/menu/user_nav.html' %}
+
+ <div class="mm_subHeader">
+ <h1>{% trans "GPG Settings" %} <span>- {{ user }}</span></h1>
+ </div>
+ {% if mm_user.key %}
+ <b>Key Fingerprint:</b>{{ mm_user.key.fingerprint }}<br>
+ <b>Key Expiration Date:</b>{{ mm_user.key.expires }}
+ {% else %}
+ Enter your public key id:
+ <form action="{% url 'user_gpgsettings' %}" method="POST">
+ {% csrf_token %}
+ <input type="text" name="key_id">
+ <input type="submit" value="{% trans 'Submit' %}" class="btn btn-success">
+ </form>
+ Or copy-paste your public-key data:
+ <form action="{% url 'user_gpgsettings' %}" method="POST">
+ {% csrf_token %}
+ <textarea name="key_data" cols="500" rows="10"></textarea>
+ <br />
+ <input type="submit" value="{% trans 'Submit' %}" class="btn btn-success">
+ </form>
+ {% endif %}
+
+{% endblock %}
=== modified file 'src/postorius/templates/postorius/users/index.html'
--- src/postorius/templates/postorius/users/index.html 2013-07-05 11:05:45 +0000
+++ src/postorius/templates/postorius/users/index.html 2013-09-23 20:31:56 +0000
@@ -12,43 +12,50 @@
{% endif %}
<table class="table table-bordered table-striped">
- <thead>
- <tr>
- <th>{% trans 'Email' %}</th>
- <th>{% trans 'Display name' %}</th>
- <th></th> <!-- header for delete user button -->
- <!-- th>{% trans 'Web User' %}</th -->
- <!--th>{% trans 'Mailman User' %}</th -->
- </tr>
- </thead>
- <tbody>
- {% for mm_user in mm_user_page %}
- <tr>
- <td>
- <a href="{% url 'user_summary' user_id=mm_user.user_id %}">{% for address in mm_user.addresses|slice:":1" %}{{ address }}{% endfor %}</a>
- </td>
- <td>
- {{ mm_user.display_name }}
- </td>
- <td>
- <a href="{{mm_user.user_id}}/delete" class="btn btn-mini btn-danger">Delete</a>
- </td>
- <!--td><i class="icon-ok"></i></td -->
- <!--td><i class="icon-remove"></i></td -->
- </tr>
- {% endfor %}
- </tbody>
+ <thead>
+ <tr>
+ <th>{% trans 'Email' %}</th>
+ <th>{% trans 'Display name' %}</th>
+ <th>{% trans 'Key Fingerprint' %}
+ <th></th> <!-- header for delete user button -->
+ <!-- th>{% trans 'Web User' %}</th -->
+ <!--th>{% trans 'Mailman User' %}</th -->
+ </tr>
+ </thead>
+ <tbody>
+ {% for mm_user in mm_user_page %}
+ <tr>
+ <td>
+ <a href="{% url 'user_summary' user_id=mm_user.user_id %}">{% for address in mm_user.addresses|slice:":1" %}{{ address }}{% endfor %}</a>
+ </td>
+ <td>
+ {{ mm_user.display_name }}
+ </td>
+ <td>
+ {% if mm_user.key %}
+ {{ mm_user.key.fingerprint }}
+ {% else %}
+ No Key!
+ {% endif %}
+ <td>
+ <a href="{{mm_user.user_id}}/delete" class="btn btn-mini btn-danger">Delete</a>
+ </td>
+ <!--td><i class="icon-ok"></i></td -->
+ <!--td><i class="icon-remove"></i></td -->
+ </tr>
+ {% endfor %}
+ </tbody>
</table>
-
+
<div class="pagination pagination-centered">
- <ul>
- {% if mm_user_page_nr > 1 %}
- <li><a href="{% url 'user_index_paged' mm_user_page_previous_nr %}">«</a></li>
- {% else %}
- <li class="disabled"><span>«</span></li>
- {% endif %}
+ <ul>
+ {% if mm_user_page_nr > 1 %}
+ <li><a href="{% url 'user_index_paged' mm_user_page_previous_nr %}">«</a></li>
+ {% else %}
+ <li class="disabled"><span>«</span></li>
+ {% endif %}
- <li><span>{{ mm_user_page_nr }}</span></li>
+ <li><span>{{ mm_user_page_nr }}</span></li>
{% if mm_user_page_show_next %}
<li><a href="{% url 'user_index_paged' mm_user_page_next_nr %}">»</a></li>
=== modified file 'src/postorius/urls.py'
--- src/postorius/urls.py 2013-07-05 11:05:45 +0000
+++ src/postorius/urls.py 2013-09-23 20:31:56 +0000
@@ -69,8 +69,9 @@
url(r'^accounts/subscriptions/$', UserSubscriptionsView.as_view(),
name='user_subscriptions'),
url(r'^accounts/mailmansettings/$',
- UserMailmanSettingsView.as_view(),
- name='user_mailmansettings'),
+ UserMailmanSettingsView.as_view(), name='user_mailmansettings'),
+ url(r'^accounts/gpgsettings/$',
+ UserGPGSettingsView.as_view(), name='user_gpgsettings'),
# /settings/
url(r'^settings/$', 'site_settings', name="site_settings"),
url(r'^domains/$', 'domain_index', name='domain_index'),
@@ -79,6 +80,7 @@
'domain_delete', name='domain_delete'),
# /lists/
url(r'^lists/$', 'list_index', name='list_index'),
+ url(r'^lists/(?P<fqdn_listname>[^/]+)/create_keys$','create_keys',name='create_keys'),
url(r'^lists/new/$', 'list_new', name='list_new'),
url(r'^more_info/(?P<formid>[^/]+)/(?P<helpid>[^/]+)$', 'more_info_tab', name='more_info_tab'),
url(r'^lists/(?P<fqdn_listname>[^/]+)/', include(per_list_urlpatterns)),
=== modified file 'src/postorius/views/list.py'
--- src/postorius/views/list.py 2013-07-14 20:39:16 +0000
+++ src/postorius/views/list.py 2013-09-23 20:31:56 +0000
@@ -546,3 +546,14 @@
def membership_settings(request):
"""Display a list of all memberships.
"""
+@list_owner_required
+def create_keys(request, fqdn_listname):
+ """Create the keys associated with the list
+ """
+ try:
+ the_list = List.objects.get_or_404(fqdn_listname=fqdn_listname)
+ except MailmanApiError:
+ return utils.render_api_error(request)
+ if request.method == 'POST':
+ the_list.create_keys()
+ return redirect("list_summary", fqdn_listname)
=== modified file 'src/postorius/views/user.py'
--- src/postorius/views/user.py 2013-07-11 14:35:41 +0000
+++ src/postorius/views/user.py 2013-09-23 20:31:56 +0000
@@ -1,4 +1,4 @@
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
# Copyright (C) 1998-2013 by the Free Software Foundation, Inc.
#
# This file is part of Postorius.
@@ -100,7 +100,37 @@
return render_to_response('postorius/user_subscriptions.html',
{'memberships': memberships},
context_instance=RequestContext(request))
-
+
+
+class UserGPGSettingsView(MailmanUserView):
+ """Shows the gpg settings of a user.
+ """
+
+ def get(self, request):
+ try:
+ mm_user = MailmanUser.objects.get(address=request.user.email)
+ except MailmanApiError:
+ return utils.render_api_error(request)
+ return render_to_response('postorius/user_gpgsettings.html',
+ {'mm_user': mm_user},
+ context_instance=RequestContext(request))
+
+ def post(self, request):
+ try:
+ mm_user = MailmanUser.objects.get(address=request.user.email)
+ except MailmanApiError:
+ return utils.render_api_error(request)
+
+ for key, value in request.POST.items():
+ if key == 'key_id':
+ mm_user.import_key(key_id=value)
+ elif key == 'key_data':
+ mm_user.import_key(key_data=value)
+
+ return render_to_response('postorius/user_gpgsettings.html',
+ {'mm_user': mm_user},
+ context_instance=RequestContext(request))
+
@user_passes_test(lambda u: u.is_superuser)
def user_index(request, page=1, template='postorius/users/index.html'):
_______________________________________________
Mailman-coders mailing list
[email protected]
https://mail.python.org/mailman/listinfo/mailman-coders