feat: org status check in auth dependencies

There is a hardcoded list of methods/endpoints for which the status check isn't done. i.e. the endpoints which need to be accessed before the org is approved.

Resolves #11
This commit is contained in:
Chris Milne 2026-05-28 10:55:39 +01:00
parent 4bf5933376
commit 9efd86cd5f
2 changed files with 25 additions and 10 deletions

View file

@ -17,3 +17,11 @@ class OrgNotFoundException(HTTPException):
status_code=status.HTTP_404_NOT_FOUND,
detail=detail,
)
class AwaitingApprovalException(HTTPException):
def __init__(self, org_id: Optional[int] = None) -> None:
detail = "Organisation has not been approved." if org_id is None else f"Organisation with ID '{org_id}' has not been approved."
super().__init__(
status_code=status.HTTP_401_UNAUTHORIZED,
detail=detail,
)