1234567891011121314151617181920212223242526272829 |
- import os
- from stor import create_app, db, cli
- from stor.auth.models import Group, User
- app = create_app()
- cli.register(app)
- with app.app_context():
- db.create_all()
- admin_group = Group(name="admin")
- reviewer_group = Group(name="reviewer")
- staff_group = Group(name="staff")
- standard_group = Group(name="standard")
- db.session.add_all([admin_group, reviewer_group, staff_group, standard_group])
- db.session.add(User(
- id=1,
- username="super",
- email=os.environ["STAGING_SUPERUSER_EMAIL"],
- email_verified=True,
- activated=True,
- password_rotated=True,
- first_name="Super",
- last_name="User",
- organization_name="DCU",
- password=os.environ["STAGING_SUPERUSER_PASSWORD"],
- groups=[standard_group, staff_group, reviewer_group, admin_group],
- ))
- db.session.commit()
|