Spotix-API / backend /app /core /admin_required.py
Anish530's picture
Initial commit of full project [remaining backend some parts and frontend to be done yet]
aa27d2d
from fastapi import Depends, HTTPException
from app.core.auth_dependancy import get_current_user
def admin_required(user = Depends(get_current_user)):
if user.role != "admin":
raise HTTPException(status_code=403, detail="Restricted")
return user