def init_in_context(): db.create_all() if user_collection.find_role('admin') is None: ############################### ## Bootstrap the application ## ## CHANGE ASAP ## ############################### admin_role = user_collection.find_or_create_role(name='admin', description='The administrator', token_renew=True) # Request a put on 'api/auth' with new_password as data, see test for example user_collection.create_user(login='******', password='******', roles=[admin_role])
def _create_users(self): db.create_all() db.session.commit() # Set up two roles non_admin_role = user_collection.find_or_create_role(name='non-admin', description='The non-admin role', token_renew=False) admin_role = user_collection.find_or_create_role(name='admin', description='The administrator', token_renew=True) # Request a put on 'api/auth' with new_password as data, see test for example user_collection.create_user(login='******', password='******', roles=[admin_role]) # Set up some users user_collection.create_user(login='******', password='******', roles=[non_admin_role]) user_collection.create_user(login='******', password='******', roles=[admin_role, non_admin_role])