aboutsummaryrefslogtreecommitdiffstats
path: root/backend
diff options
context:
space:
mode:
Diffstat (limited to 'backend')
-rw-r--r--backend/authentication/backend.py2
-rw-r--r--backend/authentication/user.py4
2 files changed, 3 insertions, 3 deletions
diff --git a/backend/authentication/backend.py b/backend/authentication/backend.py
index bdff796..206d1eb 100644
--- a/backend/authentication/backend.py
+++ b/backend/authentication/backend.py
@@ -61,7 +61,7 @@ class JWTAuthenticationBackend(authentication.AuthenticationBackend):
raise authentication.AuthenticationError("Could not parse user details.")
user = User(token, user_details)
- if user.fetch_admin_status(request):
+ if await user.fetch_admin_status(request):
scopes.append("admin")
return authentication.AuthCredentials(scopes), user
diff --git a/backend/authentication/user.py b/backend/authentication/user.py
index 52baa61..857c2ed 100644
--- a/backend/authentication/user.py
+++ b/backend/authentication/user.py
@@ -34,8 +34,8 @@ class User(BaseUser):
def decoded_token(self) -> dict[str, any]:
return jwt.decode(self.token, SECRET_KEY, algorithms=["HS256"])
- def fetch_admin_status(self, request: Request) -> bool:
- self.admin = request.state.db.admins.find_one(
+ async def fetch_admin_status(self, request: Request) -> bool:
+ self.admin = await request.state.db.admins.find_one(
{"_id": self.payload["id"]}
) is not None