Skip to content

Commit

Permalink
ensure organization id matches slug
Browse files Browse the repository at this point in the history
  • Loading branch information
whitdog47 committed Jan 16, 2025
1 parent 6431560 commit 671c177
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/dispatch/auth/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ def __init__(self, request: Request):
if not organization:
raise HTTPException(status_code=self.org_error_code, detail=self.org_error_msg)

org_check = organization_service.get_by_slug(
db_session=request.state.db, slug=organization.slug
)

if not org_check or org_check.id != organization.id:
raise HTTPException(status_code=self.org_error_code, detail=self.org_error_msg)

user = get_current_user(request=request)
if not user:
raise HTTPException(status_code=self.user_error_code, detail=self.user_error_msg)
Expand Down

0 comments on commit 671c177

Please sign in to comment.