diff options
author | Frederick Muriuki Muriithi | 2025-07-16 12:19:58 -0500 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2025-07-16 12:19:58 -0500 |
commit | c28105e4977f299bbab6f5808ba68269bfab36c1 (patch) | |
tree | eb7fc409d75e2e9ed7737185cbedb76f1726be77 /gn_auth/auth/authorisation/users/views.py | |
parent | 1740ccbe30946aa6693a6a9ed8211a2ff7cfbf3d (diff) | |
download | gn-auth-c28105e4977f299bbab6f5808ba68269bfab36c1.tar.gz |
Bugfix: Handle possible missing json data.
Diffstat (limited to 'gn_auth/auth/authorisation/users/views.py')
-rw-r--r-- | gn_auth/auth/authorisation/users/views.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/gn_auth/auth/authorisation/users/views.py b/gn_auth/auth/authorisation/users/views.py index 55921ca..2ad672d 100644 --- a/gn_auth/auth/authorisation/users/views.py +++ b/gn_auth/auth/authorisation/users/views.py @@ -335,15 +335,17 @@ def user_join_request_exists(): @require_oauth("profile user") def list_all_users() -> Response: """List all the users.""" - _kwargs = { - key: value - for key, value in ( - request.json.items() if request.json - else { - "email": "", "name": "", "verified": "", "age": "" - }) - if key in ("email", "name", "verified", "age") - } + _kwargs = ( + { + key: value + for key, value in request_json().items() + if key in ("email", "name", "verified", "age") + } + or + { + "email": "", "name": "", "verified": "", "age": "" + } + ) with (require_oauth.acquire("profile group") as _the_token, db.connection(current_app.config["AUTH_DB"]) as conn, |