Download core/admin_endpoints.py from techprotrade/annator-command-center: direct link, hf CLI and curl.
- Browser
- Download file 639 Bytes
-
https://huggingface.co/spaces/techprotrade/annator-command-center/resolve/main/core/admin_endpoints.py
- Command line
-
hf download hf://spaces/techprotrade/annator-command-center/core/admin_endpoints.py
-
curl -L -o admin_endpoints.py https://huggingface.co/spaces/techprotrade/annator-command-center/resolve/main/core/admin_endpoints.py
639 Bytes
| 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 | |