From eb051063eb57391a4e95160a3f21bb5744ba0b22 Mon Sep 17 00:00:00 2001 From: sujanadh Date: Fri, 26 Jan 2024 13:51:24 +0545 Subject: [PATCH] hotfix: retrieve id and username directly instead of using .get --- src/backend/app/auth/roles.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/app/auth/roles.py b/src/backend/app/auth/roles.py index 17c16c2191..af0c6aa0bb 100644 --- a/src/backend/app/auth/roles.py +++ b/src/backend/app/auth/roles.py @@ -38,7 +38,7 @@ async def get_uid(user_data: AuthUser) -> int: """Extract user id from returned OSM user.""" - if user_id := user_data.get("id"): + if user_id := user_data.id: return user_id else: log.error(f"Failed to get user id from auth object: {user_data}") @@ -69,7 +69,7 @@ async def super_admin( if not super_admin: log.error( - f"User {user_data.get('username')} requested an admin endpoint, " + f"User {user_data.username} requested an admin endpoint, " "but is not admin" ) raise HTTPException(