Implemented default token roles, self scope for users and tokens for mockservices

This commit is contained in:
0mar
2021-03-11 19:33:05 +01:00
parent bf333d8e35
commit 7496fda089
6 changed files with 28 additions and 25 deletions

View File

@@ -617,8 +617,8 @@ class APIToken(Hashed, Base):
db.add(orm_token)
# load default roles if they haven't been initiated
# correct to have this here? otherwise some tests fail
user_role = Role.find(db, 'user')
if not user_role:
token_role = Role.find(db, 'token')
if not token_role:
default_roles = get_default_roles()
for role in default_roles:
add_role(db, role)