]> nos-oignons.net Git - gestion-adh.git/commit
Switch to Mailman 3 REST API for “ag” subscriptions
authorLunar <lunar@anargeek.net>
Fri, 30 Jun 2023 09:06:40 +0000 (11:06 +0200)
committerLunar <lunar@anargeek.net>
Fri, 30 Jun 2023 10:05:27 +0000 (12:05 +0200)
commit56d63dc536c09e07e7de107a76500ecc92cf7cb7
treebabcac4b12df196299e74210657282bd97314b60
parent01f97846a9919f81d6af6fdd76bdac0fc14572a4
Switch to Mailman 3 REST API for “ag” subscriptions

We used to control subscriptions to the “ag“ mailing list
using Mailman 2 command line interface.

Now that we use Mailman 3, we need to switch to its REST API to do the
same. Most of what is useful to us is documented at:
https://docs.mailman3.org/projects/mailman/en/latest/src/mailman/rest/docs/membership.html

The `rest-client` gem has been added to ease with implementing REST
requests.

A key difference from the old interface is that a subscription
creates a `member_id`, specific to the list and different from
the `user_id` or email address. Unsubscribing a user requires to
this `member_id`.

It is not a big issue as our process to update the list subscriptions
always start by listing all current subscriptions. We retrieve both
the `member_id` and email address at this stage. After comparing
to the list of known members, we can use the `member_id` to remove
outdated subscriptions.

The relevant Gherkin scenarios have been updated to be easier to test
with these new process but are functionally equivalent.

We also take the opportunity to move from crontab(5) to systemd.timer(5)
and systemd.service(5) to use systemd service credentials
to protect the password to Mailman REST API.
12 files changed:
Gemfile.lock
README
features/step_definitions/mailman.rb
features/support/env.rb
features/support/mock_mailman/add_members [deleted file]
features/support/mock_mailman/list_members [deleted file]
features/support/mock_mailman/remove_members [deleted file]
features/support/mock_mailman/sudo [deleted file]
features/update-ag-subscribers.feature
lib/nos_oignons.rb
lib/nos_oignons/mailman.rb
nos_oignons.gemspec