admin_dashboard_backend / app /verify_access.py
vip11017's picture
Added logged in access funtcionality
5749e42
raw
history blame contribute delete
409 Bytes
from fastapi import Depends, HTTPException
from app.get_current_users import get_current_user
async def verify_access(chatbot_id: str, current_user: dict = Depends(get_current_user)):
allowed_ids = [c["chatbot_id"] for c in current_user.get("chatbots", [])]
if chatbot_id not in allowed_ids:
raise HTTPException(status_code=403, detail="Not authorized to access this chatbot")
return True