default user role; updateProfile method

This commit is contained in:
knst-kotov
2021-12-08 15:51:30 +03:00
parent 8092d8a262
commit 6e939f43db
9 changed files with 70 additions and 15 deletions

View File

@@ -71,6 +71,9 @@ class JWTAuthenticate(AuthenticationBackend):
return AuthCredentials(scopes=[]), AuthUser(user_id=None)
user = await UserStorage.get_user(payload.user_id)
if not user:
return AuthCredentials(scopes=[]), AuthUser(user_id=None)
scopes = await user.get_permission()
return AuthCredentials(user_id=payload.user_id, scopes=scopes, logged_in=True), user