aboutsummaryrefslogtreecommitdiff
path: root/gn_auth/auth
diff options
context:
space:
mode:
Diffstat (limited to 'gn_auth/auth')
-rw-r--r--gn_auth/auth/authorisation/users/models.py5
-rw-r--r--gn_auth/auth/authorisation/users/views.py6
2 files changed, 7 insertions, 4 deletions
diff --git a/gn_auth/auth/authorisation/users/models.py b/gn_auth/auth/authorisation/users/models.py
index 1b7d8e0..d30bfd0 100644
--- a/gn_auth/auth/authorisation/users/models.py
+++ b/gn_auth/auth/authorisation/users/models.py
@@ -1,6 +1,5 @@
"""Functions for acting on users."""
import uuid
-from typing import Union
from functools import reduce
from datetime import datetime, timedelta
@@ -40,7 +39,7 @@ def __process_age_clause__(age_desc: str) -> tuple[str, int]:
raise Exception("Invalid age descriptor.")# pylint: disable=[broad-exception-raised]
-def __list_user_clauses_and_params__(**kwargs) -> tuple[str, dict[str, Union[int, str]]]:
+def __list_user_clauses_and_params__(**kwargs) -> tuple[str, dict[str, str]]:
"""Process the WHERE clauses, and params for the 'LIST USERS' query."""
clauses = ""
params = {}
@@ -66,7 +65,7 @@ def __list_user_clauses_and_params__(**kwargs) -> tuple[str, dict[str, Union[int
if bool(kwargs.get("age", "").strip()):
_clause, _param = __process_age_clause__(kwargs["age"].strip())
clauses = clauses + (" AND " if len(clauses) > 0 else "") + _clause
- params["created"] = _param
+ params["created"] = str(_param)
return clauses, params
diff --git a/gn_auth/auth/authorisation/users/views.py b/gn_auth/auth/authorisation/users/views.py
index 4006dd6..55921ca 100644
--- a/gn_auth/auth/authorisation/users/views.py
+++ b/gn_auth/auth/authorisation/users/views.py
@@ -337,7 +337,11 @@ def list_all_users() -> Response:
"""List all the users."""
_kwargs = {
key: value
- for key, value in request.json.items()
+ for key, value in (
+ request.json.items() if request.json
+ else {
+ "email": "", "name": "", "verified": "", "age": ""
+ })
if key in ("email", "name", "verified", "age")
}