Removing a moderator via the REST API
You can currently add moderators to a mailing list via the REST API by posting to the members
endpoint with role
set to moderator
.
However it doesn't appear that you can remove a person as moderator via the API, per a comment made by Mark on 8/12/24 in this thread: https://lists.mailman3.org/archives/list/mailman-users@mailman3.org/thread/D...
We've already got scripts we use to manage moderators on lists, but we're trying to convert everything over to use the API. Does anyone have an idea of when this functionality will make it into the API? Thank you.
On 11/14/24 13:44, Andy Matthews wrote:
However it doesn't appear that you can remove a person as moderator via the API, per a comment made by Mark on 8/12/24 in this thread: https://lists.mailman3.org/archives/list/mailman-users@mailman3.org/thread/D...
I'm not sure what I said there to make you think that, but first you have to be able to do this via the API because Postorius does it via mailmanclient which uses the API.
See https://gitlab.com/mailman/mailmanclient/-/blob/master/src/mailmanclient/res...
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
Ah, I must have totally misunderstood then, apologies Mark. So plucking that method here for reference:
def remove_role(self, role, address):
"""Remove a list Member with a specific Role.
:param str role: The role for the new member.
:param str address: A valid email address for the new Member.
"""
url = 'lists/%s/%s/%s' % (
self.fqdn_listname, role, quote_plus(address))
self._connection.call(url, method='DELETE')
Given a list address of announce@bar.com, and a subscriber of andy@bar.com, the API endpoint would be:
'lists/announce.bar.com/moderator/andy@bar.com'
Is that correct? One question, I think I assumed that removing a user from the list would also cascade to remove any roles that user may have had. So we're currently POSTing to lists/announce.bar.com/roster/member
, and I was expecting that to also remove the moderator role. But it sounds like it would require an extra call to explicitly remove them as moderator?
On 11/15/24 06:38, Andy Matthews wrote:
Given a list address of announce@bar.com, and a subscriber of andy@bar.com, the API endpoint would be:
'lists/announce.bar.com/moderator/andy@bar.com'
Is that correct?
Yes.
One question, I think I assumed that removing a user from the list would also cascade to remove any roles that user may have had. So we're currently POSTing to
lists/announce.bar.com/roster/member
, and I was expecting that to also remove the moderator role. But it sounds like it would require an extra call to explicitly remove them as moderator?
Yes, member, nonmember, owner and moderator roles are all separate. removing a user from one of those roles has no effect on any other role the user might have.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
participants (2)
-
Andy Matthews
-
Mark Sapiro