Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /DeepselSystems_deepsel /deepsel /auth /current_org.py
| from typing import Optional | |
| from fastapi import Header, HTTPException, status | |
| def resolve_current_organization_id( | |
| user, | |
| x_organization_id: Optional[int] = Header(default=None, alias="X-Organization-Id"), | |
| ) -> Optional[int]: | |
| """Resolve org context from the X-Organization-Id header. | |
| Returns the header value if the user is a member of that org. | |
| Returns None if the header is absent — caller decides whether None is allowed. | |
| Raises 403 if the user is not a member of the requested org. | |
| Never falls back to an implicit "first org". | |
| """ | |
| if x_organization_id is None: | |
| return None | |
| if x_organization_id not in user.get_org_ids(): | |
| raise HTTPException( | |
| status_code=status.HTTP_403_FORBIDDEN, | |
| detail="User is not a member of the requested organization", | |
| ) | |
| return x_organization_id | |
Xet Storage Details
- Size:
- 870 Bytes
- Xet hash:
- d09c851ae092a971b81f4037070b5d20e53158cc81b9b76e3b9a70a9d04a8e45
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.