Hi community,
I was wondering if there is a walk-through for the following issue - or is it even an issue? We got plenty lists with a lot of users come and go from time to time.
Thanks to the thread, I understood how to pick on adress and delete them via the mailman shell; https://lists.mailman3.org/archives/list/mailman-users@mailman3.org/thread/K...
um = getUtility(IUserManager) usr = um.get_user('user@example.com') um.delete_user(usr) commit()
Thanks to this thread, I know how to find the lost souls in our mailman environment https://lists.mailman3.org/archives/list/mailman-users@mailman3.org/thread/R...
um = getUtility(IUserManager) for usr in um.users: ... if len(list(usr.memberships.members)) > 0: ... continue ... adr = usr.addresses[0] ... print(f'Name: {adr.display_name}, Email: {adr.email}, Created: {usr.created_on}')
So I can see them now. Is there a technique, to clean them up? To get rid of them out of the system? I am not a python programmer, but I guess there is a way to use, instead of a single user, a list of users in the delete command of the mailman shell?
e.g. (sorry if this example leads to any pain for any coder/ programmer)
user1@example.com user2@example.com user3@example.com
um = getUtility(IUserManager) usr = um.get_user('user1@example.com','user2@example.com','user3@example.com') um.delete_user(usr) commit()
Hope I made my intention clear. I want to get rid of the users who don't belong/ or are subscribe to a list anymore.
Thanks in advance! Paul
El 21/2/22 a las 12:28, Paul Paulchen escribió:
Hi community,
I was wondering if there is a walk-through for the following issue - or is it even an issue? We got plenty lists with a lot of users come and go from time to time.
Thanks to the thread, I understood how to pick on adress and delete them via the mailman shell; https://lists.mailman3.org/archives/list/mailman-users@mailman3.org/thread/K...
um = getUtility(IUserManager) usr = um.get_user('user@example.com') um.delete_user(usr) commit()
Thanks to this thread, I know how to find the lost souls in our mailman environment https://lists.mailman3.org/archives/list/mailman-users@mailman3.org/thread/R...
um = getUtility(IUserManager) for usr in um.users: ... if len(list(usr.memberships.members)) > 0: ... continue ... adr = usr.addresses[0] ... print(f'Name: {adr.display_name}, Email: {adr.email}, Created: {usr.created_on}')
So I can see them now. Is there a technique, to clean them up? To get rid of them out of the system? I am not a python programmer, but I guess there is a way to use, instead of a single user, a list of users in the delete command of the mailman shell?
e.g. (sorry if this example leads to any pain for any coder/ programmer)
user1@example.com user2@example.com user3@example.com
um = getUtility(IUserManager) usr = um.get_user('user1@example.com','user2@example.com','user3@example.com') um.delete_user(usr) commit()
Hope I made my intention clear. I want to get rid of the users who don't belong/ or are subscribe to a list anymore.
I understand you want this:
https://lists.mailman3.org/archives/list/mailman-users@mailman3.org/message/...
Thanks in advance! Paul
Mailman-users mailing list -- mailman-users@mailman3.org To unsubscribe send an email to mailman-users-leave@mailman3.org https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/
Hi.
I have been using the following in a Cron job for the past few months and it keeps my server clean of additional users in both Mailman and Django.
https://lists.mailman3.org/archives/list/mailman-users@mailman3.org/thread/G...
Andrew.
On 2/21/22 03:28, Paul Paulchen wrote:
Thanks to this thread, I know how to find the lost souls in our mailman environment https://lists.mailman3.org/archives/list/mailman-users@mailman3.org/thread/R...
um = getUtility(IUserManager) for usr in um.users: ... if len(list(usr.memberships.members)) > 0: ... continue ... adr = usr.addresses[0] ... print(f'Name: {adr.display_name}, Email: {adr.email}, Created: {usr.created_on}')
So I can see them now. Is there a technique, to clean them up? To get rid of them out of the system? I am not a python programmer, but I guess there is a way to use, instead of a single user, a list of users in the delete command of the mailman shell?
The replies by Guillermo and Andrew both point to a message/thread containing the same clean_users.py script. This script will do some of what you want, but maybe not all of it. It will delete Django users who have no corresponding Mailman user or have a corresponding Mailman user that has no role on any list, and optionally delete the Mailman user as well.
What it won't do is delete a Mailman user that has no role on any list if there is no corresponding Django user. For that you would want to add to the above fragment so it becomes:
>>> um = getUtility(IUserManager)
>>> for usr in um.users:
... if len(list(usr.memberships.members)) > 0:
... continue
... adr = usr.addresses[0]
... print(f'Name: {adr.display_name}, Email: {adr.email}, Created:
{usr.created_on}')
... um.delete_user(usr)
... print(' Deleted.)
...
>>> commit()
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
participants (4)
-
Andrew Hodgson
-
Guillermo Hernandez (Oldno7)
-
Mark Sapiro
-
Paul Paulchen