Hi all,

Currently, django has user management commands createsuperuser and
changepassword
<https://github.com/django/django/tree/master/django/contrib/auth/management/commands>,
which allow to automate some user management with an automated
Configuration Management (CM) tool, such as Ansible.

For example, you have a list of users in an a site-specific configuration
data repository, ie. of yaml files. You can program your CM can iterate on
it to create super users (example
<https://yourlabs.io/oss/playlabs/blob/master/playlabs/plugins/django/deploy.post.yml#L10-20>
).

The only issue is that it will choke when trying to create duplicates so
that's one thing I'd like to request comments about with the purpose of a
patch proposal to provide an idempotent command (example
<https://yourlabs.io/snippets/5>). Another possibility to achieve
idempotence is to use another username list.

However what happens when a user leaves the team is that we add them to
another list, "remove_users" (example
<https://yourlabs.io/oss/playlabs/blob/master/playlabs/inventory_template/group_vars/all/users.yml#L57>).
Our CM will iterate over those, and delete the users. It would be easier
with a CLI command to drop a user /by login name/.

Yes of course we can stack some statements with semi colons, injecting code
into stdin of the django-admin shell command, and create a juicy one-liner.
I've been doing that for a while myself (some years), over again, so if
you're open to contributions I can direct some of that energy upstream
instead of in my own one-liners / deployment recipes.

I don't think this is a good candidate for being in an external app in my
opinion because the CM recipe should work with a Django fresh project, and
not require to install an extra app, hence the "containing it in a
one-liner".

Thanks for reading,

Have a great day

-- 
∞

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAC6Op1_2iuRVFonCsYFhNZEfTfwfqEJB4PC0upjtYMzphvKXzg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to