File size: 639 Bytes
92c4ae6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | from fastapi import Depends, HTTPException, status
from core.auth import get_current_user
from core.models import User, UserRole
async def get_super_admin(current_user: User = Depends(get_current_user)):
"""
Dependency to ensure the current user is a super admin.
Used for sensitive platform-level health and administrative routes.
"""
if current_user.role != UserRole.SUPER_ADMIN.value and current_user.role != UserRole.SUPER_ADMIN:
raise HTTPException(
status_code=status.HTTP_403_FORBIDDEN,
detail="Super Admin access required for this operation"
)
return current_user
|