Buckets:

download
raw
528 Bytes
from fastapi import Request, HTTPException
from src.core.config.config import settings
import jwt
def role_required(role: str):
def role_checker(request: Request):
token = request.headers.get("Authorization").split(" ")[1]
payload = jwt.decode(token, settings.secret_key, algorithms=[settings.algorithm])
user_roles = payload.get("roles", [])
if role not in user_roles:
raise HTTPException(status_code=403, detail="Permission denied")
return True
return role_checker

Xet Storage Details

Size:
528 Bytes
·
Xet hash:
fc5c7c72f1cc46a4a02d7438b442a729029fd4f0feea8843b818f9f65efc9251

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.