Skip to content

Commit

Permalink
api.main: perform authorization for GET '/users'
Browse files Browse the repository at this point in the history
Only allow authorized users to get existing
users' details to protect user's personal
information.

Signed-off-by: Jeny Sadadia <[email protected]>
  • Loading branch information
Jeny Sadadia committed Dec 8, 2023
1 parent 870415b commit 849f178
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ async def authorize_user(node_id: str,
@app.get('/users', response_model=PageModel, tags=["user"],
response_model_exclude={"items": {"__all__": {
"hashed_password"}}})
async def get_users(request: Request):
async def get_users(request: Request,
current_user: User = Depends(get_current_user)):
"""Get all the users if no request parameters have passed.
Get the matching users otherwise."""
query_params = dict(request.query_params)
Expand Down

0 comments on commit 849f178

Please sign in to comment.