def new_user(username, password, admin=0): """Adds a new user to the app Parameters: username: str password: str admin: {0, 1}, default=0 if 1 the user is made admin otherwise simple user """ add_user(username, password, admin=admin) if admin: print('ADMIN User {} created and initialised'.format(username)) else: print('User {} created and initialised'.format(username))
def init(username='******', password='******', admin=1): """(re-)initialises the database and sets a new user Parameters: username: str password: str admin: {0, 1}, default=1 if 1 the user is made admin otherwise simple user """ Annotation.drop_collection() User.drop_collection() print('Database init.') add_user(username, password, admin=admin) if admin: print('ADMIN User {} created and initialised'.format(username)) else: print('User {} created and initialised'.format(username))