mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: deny anonymous user from getting orgs
This commit is contained in:
parent
74ccbc5738
commit
3f2d9d2b9f
1 changed files with 6 additions and 0 deletions
|
|
@ -149,6 +149,12 @@ async def get_orgs_by_user(request: Request, user_id: str, page: int = 1, limit:
|
|||
orgs = request.app.db["organizations"]
|
||||
user = request.app.db["users"]
|
||||
|
||||
if user_id is "anonymous":
|
||||
|
||||
# raise error
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_409_CONFLICT, detail="User not logged in")
|
||||
|
||||
# get user orgs
|
||||
user_orgs = await user.find_one({"user_id": user_id})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue