aboutsummaryrefslogtreecommitdiff
path: root/gn3/auth/authorisation/users
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-02-10 14:07:41 +0300
committerFrederick Muriuki Muriithi2023-02-10 14:07:41 +0300
commita93b9599d6e342f8fd588022ca14336465f7ff7c (patch)
tree63caea29caf15f723341341026706a4601b0a7b3 /gn3/auth/authorisation/users
parent0d2a9c130531a2786b2dd01adc172e5005f13f59 (diff)
downloadgenenetwork3-a93b9599d6e342f8fd588022ca14336465f7ff7c.tar.gz
Return empty tuple rather than Nothing
When user has no roles assigned, return an empty tuple rather than pymonad.maybe.Nothing to ease maintenance.
Diffstat (limited to 'gn3/auth/authorisation/users')
-rw-r--r--gn3/auth/authorisation/users/views.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/gn3/auth/authorisation/users/views.py b/gn3/auth/authorisation/users/views.py
index 8a29fea..c592a3f 100644
--- a/gn3/auth/authorisation/users/views.py
+++ b/gn3/auth/authorisation/users/views.py
@@ -46,9 +46,7 @@ def user_roles() -> Response:
with require_oauth.acquire("role") as token:
with db.connection(current_app.config["AUTH_DB"]) as conn:
return jsonify(tuple(
- dictify(role) for role in
- _user_roles(conn, token.user).maybe(# type: ignore[misc]
- tuple(), lambda roles: roles)))
+ dictify(role) for role in _user_roles(conn, token.user)))
def __email_valid__(email: str) -> Tuple[bool, Optional[str]]:
"""Validate the email address."""