auth-debug
All checks were successful
Deploy on push / deploy (push) Successful in 24s

This commit is contained in:
Untone 2024-04-30 16:18:50 +03:00
parent 61c7f5a0dc
commit 9aacb75e84

View File

@ -15,8 +15,9 @@ async def get_author_by_user(user: str):
result = await redis.execute("GET", redis_key) result = await redis.execute("GET", redis_key)
if isinstance(result, str): if isinstance(result, str):
author = json.loads(result) author = json.loads(result)
if author:
return author return author
return
async def request_data(gql, headers=None): async def request_data(gql, headers=None):
@ -99,6 +100,8 @@ def login_required(f):
info.context["user_id"] = user_id.strip() info.context["user_id"] = user_id.strip()
info.context["roles"] = user_roles info.context["roles"] = user_roles
author = await get_author_by_user(user_id) author = await get_author_by_user(user_id)
if not author:
logger.error(f'author profile not found for user {user_id}')
info.context["author"] = author info.context["author"] = author
return await f(*args, **kwargs) return await f(*args, **kwargs)