debug-improved
Some checks failed
Deploy on push / deploy (push) Failing after 3m44s

This commit is contained in:
2025-08-28 20:19:30 +03:00
parent 8be128a69c
commit d677d6547c
6 changed files with 87 additions and 9 deletions

View File

@@ -9,11 +9,10 @@ import time
from functools import wraps
from typing import Any, Callable
from graphql.error import GraphQLError
from starlette.requests import Request
from auth.email import send_auth_email
from auth.exceptions import InvalidPasswordError, InvalidTokenError, ObjectNotExistError
from auth.exceptions import AuthorizationError, InvalidPasswordError, InvalidTokenError, ObjectNotExistError
from auth.identity import Identity
from auth.internal import verify_internal_auth
from auth.jwtcodec import JWTCodec
@@ -759,13 +758,13 @@ class AuthService:
user_id, user_roles, is_admin = await self.check_auth(req)
if not user_id:
msg = "Требуется авторизация"
raise GraphQLError(msg)
logger.info("[login_required] Авторизация не пройдена - токен отсутствует или недействителен")
raise AuthorizationError("Требуется авторизация")
# Проверяем роль reader
if "reader" not in user_roles and not is_admin:
msg = "У вас нет необходимых прав для доступа"
raise GraphQLError(msg)
logger.info(f"[login_required] Недостаточно прав - роли: {user_roles}, требуется 'reader'")
raise AuthorizationError("У вас нет необходимых прав для доступа")
logger.info(f"Авторизован пользователь {user_id} с ролями: {user_roles}")
info.context["roles"] = user_roles