summaryrefslogtreecommitdiff
path: root/src/mailman/rest
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/rest')
-rw-r--r--src/mailman/rest/docs/listconf.rst12
-rw-r--r--src/mailman/rest/docs/systemconf.rst12
-rw-r--r--src/mailman/rest/listconf.py16
-rw-r--r--src/mailman/rest/tests/test_listconf.py4
-rw-r--r--src/mailman/rest/tests/test_systemconf.py16
5 files changed, 54 insertions, 6 deletions
diff --git a/src/mailman/rest/docs/listconf.rst b/src/mailman/rest/docs/listconf.rst
index 3434f2a3d..343e50715 100644
--- a/src/mailman/rest/docs/listconf.rst
+++ b/src/mailman/rest/docs/listconf.rst
@@ -44,6 +44,10 @@ All readable attributes for a list are available on a sub-resource.
digest_volume_frequency: monthly
digests_enabled: True
display_name: Ant
+ dmarc_mitigate_action: no_mitigation
+ dmarc_mitigate_unconditionally: False
+ dmarc_moderation_notice:
+ dmarc_wrapped_message_text:
filter_content: False
first_strip_reply_to: False
footer_uri:
@@ -110,6 +114,10 @@ When using ``PUT``, all writable attributes must be included.
... digest_size_threshold=10.5,
... digest_volume_frequency='yearly',
... digests_enabled=False,
+ ... dmarc_mitigate_action='munge_from',
+ ... dmarc_mitigate_unconditionally=False,
+ ... dmarc_moderation_notice='Some moderation notice',
+ ... dmarc_wrapped_message_text='some message text',
... posting_pipeline='virgin',
... filter_content=True,
... first_strip_reply_to=True,
@@ -162,6 +170,10 @@ These values are changed permanently.
digest_volume_frequency: yearly
digests_enabled: False
display_name: Fnords
+ dmarc_mitigate_action: munge_from
+ dmarc_mitigate_unconditionally: False
+ dmarc_moderation_notice: Some moderation notice
+ dmarc_wrapped_message_text: some message text
filter_content: True
first_strip_reply_to: True
footer_uri:
diff --git a/src/mailman/rest/docs/systemconf.rst b/src/mailman/rest/docs/systemconf.rst
index 385588077..e61dd2cc9 100644
--- a/src/mailman/rest/docs/systemconf.rst
+++ b/src/mailman/rest/docs/systemconf.rst
@@ -9,7 +9,8 @@ get a list of all defined sections.
http_etag: ...
sections: ['antispam', 'archiver.mail_archive', 'archiver.master', ...
-You can also get all the values for a particular section.
+You can also get all the values for a particular section, such as the
+``[mailman]`` section...
>>> dump_json('http://localhost:9001/3.0/system/configuration/mailman')
cache_life: 7d
@@ -26,6 +27,15 @@ You can also get all the values for a particular section.
sender_headers: from from_ reply-to sender
site_owner: noreply@example.com
+...or the ``[dmarc]`` section (or any other).
+
+ >>> dump_json('http://localhost:9001/3.0/system/configuration/dmarc')
+ cache_lifetime: 7d
+ http_etag: ...
+ org_domain_data_url: https://publicsuffix.org/list/public_suffix_list.dat
+ resolver_lifetime: 5s
+ resolver_timeout: 3s
+
Dotted section names work too, for example, to get the French language
settings section.
diff --git a/src/mailman/rest/listconf.py b/src/mailman/rest/listconf.py
index 94598b0ab..d5a1ca0c1 100644
--- a/src/mailman/rest/listconf.py
+++ b/src/mailman/rest/listconf.py
@@ -24,7 +24,8 @@ from mailman.interfaces.archiver import ArchivePolicy
from mailman.interfaces.autorespond import ResponseAction
from mailman.interfaces.digests import DigestFrequency
from mailman.interfaces.mailinglist import (
- IAcceptableAliasSet, IMailingList, ReplyToMunging, SubscriptionPolicy)
+ DMARCMitigateAction, IAcceptableAliasSet, IMailingList, ReplyToMunging,
+ SubscriptionPolicy)
from mailman.interfaces.template import ITemplateManager
from mailman.rest.helpers import (
GetterSetter, bad_request, etag, no_content, not_found, okay)
@@ -128,7 +129,9 @@ ATTRIBUTES = dict(
admin_notify_mchanges=GetterSetter(as_boolean),
administrivia=GetterSetter(as_boolean),
advertised=GetterSetter(as_boolean),
+ allow_list_posts=GetterSetter(as_boolean),
anonymous_list=GetterSetter(as_boolean),
+ archive_policy=GetterSetter(enum_validator(ArchivePolicy)),
autorespond_owner=GetterSetter(enum_validator(ResponseAction)),
autorespond_postings=GetterSetter(enum_validator(ResponseAction)),
autorespond_requests=GetterSetter(enum_validator(ResponseAction)),
@@ -136,7 +139,6 @@ ATTRIBUTES = dict(
autoresponse_owner_text=GetterSetter(str),
autoresponse_postings_text=GetterSetter(str),
autoresponse_request_text=GetterSetter(str),
- archive_policy=GetterSetter(enum_validator(ArchivePolicy)),
bounces_address=GetterSetter(None),
collapse_alternatives=GetterSetter(as_boolean),
convert_html_to_plaintext=GetterSetter(as_boolean),
@@ -144,22 +146,27 @@ ATTRIBUTES = dict(
default_member_action=GetterSetter(enum_validator(Action)),
default_nonmember_action=GetterSetter(enum_validator(Action)),
description=GetterSetter(no_newlines_validator),
+ display_name=GetterSetter(str),
digest_last_sent_at=GetterSetter(None),
digest_send_periodic=GetterSetter(as_boolean),
digest_size_threshold=GetterSetter(float),
digest_volume_frequency=GetterSetter(enum_validator(DigestFrequency)),
digests_enabled=GetterSetter(as_boolean),
+ dmarc_mitigate_action=GetterSetter(
+ enum_validator(DMARCMitigateAction)),
+ dmarc_mitigate_unconditionally=GetterSetter(as_boolean),
+ dmarc_moderation_notice=GetterSetter(str),
+ dmarc_wrapped_message_text=GetterSetter(str),
filter_content=GetterSetter(as_boolean),
first_strip_reply_to=GetterSetter(as_boolean),
fqdn_listname=GetterSetter(None),
- mail_host=GetterSetter(None),
- allow_list_posts=GetterSetter(as_boolean),
include_rfc2369_headers=GetterSetter(as_boolean),
info=GetterSetter(str),
join_address=GetterSetter(None),
last_post_at=GetterSetter(None),
leave_address=GetterSetter(None),
list_name=GetterSetter(None),
+ mail_host=GetterSetter(None),
moderator_password=GetterSetter(password_bytes_validator),
next_digest_number=GetterSetter(None),
no_reply_address=GetterSetter(None),
@@ -167,7 +174,6 @@ ATTRIBUTES = dict(
post_id=GetterSetter(None),
posting_address=GetterSetter(None),
posting_pipeline=GetterSetter(pipeline_validator),
- display_name=GetterSetter(str),
reply_goes_to_list=GetterSetter(enum_validator(ReplyToMunging)),
reply_to_address=GetterSetter(str),
request_address=GetterSetter(None),
diff --git a/src/mailman/rest/tests/test_listconf.py b/src/mailman/rest/tests/test_listconf.py
index 3260d6afb..b9b64464c 100644
--- a/src/mailman/rest/tests/test_listconf.py
+++ b/src/mailman/rest/tests/test_listconf.py
@@ -62,6 +62,10 @@ RESOURCE = dict(
digest_volume_frequency='monthly',
digests_enabled=True,
display_name='Fnords',
+ dmarc_mitigate_action='munge_from',
+ dmarc_mitigate_unconditionally=False,
+ dmarc_moderation_notice='Some moderation notice',
+ dmarc_wrapped_message_text='some message text',
filter_content=True,
first_strip_reply_to=True,
goodbye_message_uri='mailman:///goodbye.txt',
diff --git a/src/mailman/rest/tests/test_systemconf.py b/src/mailman/rest/tests/test_systemconf.py
index e76c082df..480af4e3b 100644
--- a/src/mailman/rest/tests/test_systemconf.py
+++ b/src/mailman/rest/tests/test_systemconf.py
@@ -51,6 +51,21 @@ class TestSystemConfiguration(unittest.TestCase):
site_owner='noreply@example.com',
))
+ def test_dmarc_system_configuration(self):
+ # Test the [dmarc] section.
+ url = 'http://localhost:9001/3.0/system/configuration/dmarc'
+ json, response = call_api(url)
+ # There must be an `http_etag` key, but we don't care about its value.
+ self.assertIn('http_etag', json)
+ del json['http_etag']
+ self.assertEqual(json, dict(
+ cache_lifetime='7d',
+ org_domain_data_url= # noqa: E251
+ 'https://publicsuffix.org/list/public_suffix_list.dat',
+ resolver_lifetime='5s',
+ resolver_timeout='3s',
+ ))
+
def test_dotted_section(self):
# A dotted section works too.
url = 'http://localhost:9001/3.0/system/configuration/language.fr'
@@ -99,6 +114,7 @@ class TestSystemConfiguration(unittest.TestCase):
'database',
'devmode',
'digests',
+ 'dmarc',
'language.ar',
'language.ast',
'language.ca',