I want a Python-Script which does the following:
Add and remove users via the mailman api to mailinglists based on their membership in LDAP-Groups.
In more depth:
1. Get a list from file which maps groupnames to email-addresses
Group1:group1[at][login to view URL]
Group2:group2[at][login to view URL]
2. Query LDAP Server to get all email-addresses and display names for members of a groupOfNames-Object where the CN is equal to the group-name queried from the file in Step 1 and which are not also member of a groupOfName-Object where the CN is equal to the group-name queried from the file with a suffix _NoMail.
3. Call the Mailman3 API ([login to view URL]) and manage users mailinglistesubscription:
a) If a user found within 2 is not already member of the mailinglist where the email-address is equal to the email-address queried from file for the current group add the user to the mailinglist.
b) If a user is member of the mailinglist which is not found within 2, remove the user. I would be happy if you can propose the development of this.