Created
January 22, 2020 17:02
-
-
Save Porter97/f28ce03cae10e206f6df5261ed65bdea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Role.insert_roles() | |
admin_role = Role.query.filter_by(name=’Administrator’).first() | |
default_role = Role.query.filter_by(default=True).first() | |
for u in User.query.all(): | |
if u.role is None: | |
if u.email == app.config[‘OFFBRAND_ADMIN’]: | |
u.role = admin_role | |
else: | |
u.role = default_role | |
db.session.commit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment