Update "RBAC"

This commit is contained in:
Santiago Lo Coco 2023-12-01 19:46:56 -03:00
parent 6d1389eb8e
commit d8213f486d
2 changed files with 5 additions and 5 deletions

View File

@ -29,7 +29,7 @@ async def get_chat_by_user_id(
user_id: int,
authorization: Annotated[str | None, Header()] = None,
):
await checkAuth(req, authorization)
await checkAuth(req, authorization, userId=user_id)
query = {}
query["user_id"] = user_id
request_id = req.state.request_id

View File

@ -4,7 +4,7 @@ from asyncreq import request
from fastapi import APIRouter, Header, HTTPException, Request
from src.api.config import API_SUBSCRIPTIONS
from src.api.routes.auth import status as checkAuth
from src.api.routes.auth import checkAuth
from src.api.schemas.subscriptions import Subscription
router = APIRouter()
@ -16,7 +16,7 @@ async def create_subscription(
req: Request,
authorization: Annotated[str | None, Header()] = None,
):
await checkAuth(req, authorization)
await checkAuth(req, authorization, userId=subscription.user_id)
request_id = req.state.request_id
header = {"x-api-request-id": request_id}
(response, status, _) = await request(
@ -33,7 +33,7 @@ async def delete_subscription(
req: Request,
authorization: Annotated[str | None, Header()] = None,
):
await checkAuth(req, authorization)
await checkAuth(req, authorization, userId=subscription.user_id)
request_id = req.state.request_id
header = {"x-api-request-id": request_id}
(response, status, _) = await request(
@ -51,7 +51,7 @@ async def get_subscriptions(
flight_id: Optional[int] = None,
authorization: Annotated[str | None, Header()] = None,
):
await checkAuth(req, authorization)
await checkAuth(req, authorization, userId=user_id)
query = {}
query["user_id"] = user_id
if flight_id: