lesslogs
All checks were successful
Deploy on push / deploy (push) Successful in 2m55s

This commit is contained in:
2025-09-28 17:26:23 +03:00
parent 752e2dcbdc
commit af0f3e3dea
3 changed files with 17 additions and 154 deletions

View File

@@ -44,12 +44,6 @@ class EnhancedGraphQLHTTPHandler(GraphQLHTTPHandler):
except Exception as e:
logger.debug(f"[graphql] Ошибка при получении заголовков: {e}")
logger.debug(f"[graphql] Заголовки в get_context_for_request: {list(headers.keys())}")
if "authorization" in headers:
logger.debug(f"[graphql] Authorization header найден: {headers['authorization'][:50]}...")
else:
logger.debug("[graphql] Authorization header НЕ найден")
# Получаем стандартный контекст от базового класса
context = await super().get_context_for_request(request, data)
@@ -67,15 +61,6 @@ class EnhancedGraphQLHTTPHandler(GraphQLHTTPHandler):
auth_cred: Any | None = request.scope.get("auth")
context["auth"] = auth_cred
# Безопасно логируем информацию о типе объекта auth
logger.debug(f"[graphql] Добавлены данные авторизации в контекст из scope: {type(auth_cred).__name__}")
# Проверяем, есть ли токен в auth_cred
if auth_cred is not None and hasattr(auth_cred, "token") and auth_cred.token:
token_val = auth_cred.token
token_len = len(token_val) if hasattr(token_val, "__len__") else 0
logger.debug(f"[graphql] Токен найден в auth_cred: {token_len}")
else:
logger.debug("[graphql] Токен НЕ найден в auth_cred")
# Добавляем author_id в контекст для RBAC
author_id = None
@@ -89,16 +74,8 @@ class EnhancedGraphQLHTTPHandler(GraphQLHTTPHandler):
try:
author_id_int = int(str(author_id).strip())
context["author"] = {"id": author_id_int}
logger.debug(f"[graphql] Добавлен author_id в контекст: {author_id_int}")
except (ValueError, TypeError) as e:
logger.error(f"[graphql] Ошибка преобразования author_id {author_id}: {e}")
context["author"] = {"id": author_id}
logger.debug(f"[graphql] Добавлен author_id как строка: {author_id}")
else:
logger.debug("[graphql] author_id не найден в auth_cred")
else:
logger.debug("[graphql] Данные авторизации НЕ найдены в scope")
logger.debug("[graphql] Подготовлен расширенный контекст для запроса")
return context