aboutsummaryrefslogtreecommitdiff
path: root/gn3/auth/authorisation/views.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-01-21 03:17:44 +0300
committerFrederick Muriuki Muriithi2023-01-21 03:17:44 +0300
commita95819958123282b5b961cf88afd8e5588acb666 (patch)
tree8b51ab0ebde1fbd710b5cd3e2bb1b1cdb3111c44 /gn3/auth/authorisation/views.py
parentda57ac8cb3daf5d14841c0c3b6d0261a49c69504 (diff)
downloadgenenetwork3-a95819958123282b5b961cf88afd8e5588acb666.tar.gz
auth: Roles - Fix bug with role retrieval.
Diffstat (limited to 'gn3/auth/authorisation/views.py')
-rw-r--r--gn3/auth/authorisation/views.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/gn3/auth/authorisation/views.py b/gn3/auth/authorisation/views.py
index 1c59ed1..9f0b68b 100644
--- a/gn3/auth/authorisation/views.py
+++ b/gn3/auth/authorisation/views.py
@@ -33,12 +33,13 @@ def user_details():
})
@oauth2.route("/user-roles", methods=["GET"])
-@require_oauth
+@require_oauth("role")
def user_roles():
"""Return the non-resource roles assigned to the user."""
with require_oauth.acquire("role") as token:
with db.connection(current_app.config["AUTH_DB"]) as conn:
- return jsonify(_user_roles(conn, token.user))
+ return jsonify(_user_roles(conn, token.user).maybe(
+ tuple(), lambda rls: rls))
def __email_valid__(email: str) -> Tuple[bool, Optional[str]]:
"""Validate the email address."""