Programmatic Creation of Users
I am returning to Mailman after being away for a LONG time and I need to create 40 lists with ~350 subscribers spread across those lists. After a lot of testing I am now able to create users from the Core Shell and set (most of) the necessary values. Having jumped that hurdle I have hit a roadblock and I am hoping that the list can provide some insight and/or solutions.
After a lot of research I now understand that what I am doing in the Core Shell is creating a User entity which has one or more email addresses as well as one or more roles and preferences that exist at the global level. This user entity can Subscribe to zero or more lists. If I am incorrect in the summation please let me know!
Assuming that the previous information is correct that brings us to my current dilemma. Specifically, the User entity can Subscribe and interact with lists using the email commands, but they can't Login using the Postorius web interface. If I understand correctly the reason that they can't login is that the underlying Django system does not recognize their account because the account that was created in Core isn't accessible by Django. Instead the user needs to create a Django-specific account at which point the information from Core becomes available in the user's web UI.
If that is in fact accurate then I want to take the next logical leap: is it possible to programmatically create an account in Django that is tied to the account that was created in Core?
Any information is greatly appreciated! -John
On 7/30/22 05:25, jciesla@techsupportme.com wrote:
After a lot of research I now understand that what I am doing in the Core Shell is creating a User entity which has one or more email addresses as well as one or more roles and preferences that exist at the global level. This user entity can Subscribe to zero or more lists. If I am incorrect in the summation please let me know!
Almost correct. A User does have preferences but does not have roles. Roles are associated with list memberships, not users.
Assuming that the previous information is correct that brings us to my current dilemma. Specifically, the User entity can Subscribe and interact with lists using the email commands, but they can't Login using the Postorius web interface. If I understand correctly the reason that they can't login is that the underlying Django system does not recognize their account because the account that was created in Core isn't accessible by Django. Instead the user needs to create a Django-specific account at which point the information from Core becomes available in the user's web UI.
The simple view is that Django users and Mailman Users are unrelated. Either can exist without the other. They only tie together if they have the same email address. That is the only connection between them.
If that is in fact accurate then I want to take the next logical leap: is it possible to programmatically create an account in Django that is tied to the account that was created in Core?
See the script at https://www.msapiro.net/scripts/clean_users.py. This is an example that deals with Django users and Mailman Users and deletes some Django users. See https://docs.djangoproject.com/en/4.0/topics/db/queries/#creating-objects for information about creating objects.
Also see the UserManager class in django/contrib/auth/models.py
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
participants (2)
-
jciesla@techsupportme.com
-
Mark Sapiro