Skip to content

Documentation for adding new users (programmatically? at all?) #146

@muziejus

Description

@muziejus

Hi, I feel I'm so close to getting this to work…

I wrote a script, new_user.py, to add a user to my install (the goal is to add all of my students):

import dhbox
a = [("muziejus@blah.com", "muziejus-admin", "password")]
for user in a:
    the_user = dhbox.user_datastore.create_user(email=user[0], name=user[1], password=user[2], dhbox_duration=1000000000)
    # Uncomment to make admins    
    # dhbox.user_datastore.add_role_to_user(the_user, dhbox.Role.query.filter(dhbox.Role.name == 'admin').first())
    dhbox.DockerBackend.setup_new_dhbox(user[1], user[2], user[0])
dhbox.db.session.commit()

This creates a user in the db and a box for the user. It clearly assumes that no such user already exists. I can login, I can use the web-based cli and login there with the username and password above. Jupyter has some fits accepting the password, but that seems to be a Safari issue, because it's not flashing "invalid password." It just reloads the login.

So, point is, I think there should be a bit of documentation about this? I can write something but I'm not sure I have all of the nuances right…

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions