aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-09-22 07:51:20 +0300
committerFrederick Muriuki Muriithi2023-09-26 03:44:32 +0300
commitd57d13f3b82b5c981c4cadf0b74a0583a1535250 (patch)
tree76bb77c3d7953e55879864dd407f21795ee9a930
parent961bef8934f8f37081214aa3ff1d58766800fe3f (diff)
downloadgn-auth-d57d13f3b82b5c981c4cadf0b74a0583a1535250.tar.gz
Update /roles endpoint: rework code for new `user_roles` function
The way the `gn_auth.auth.authorisation.roles.models.user_roles` function works has changed: this commit updates the code to take that into consideration and fix any errors.
-rw-r--r--gn_auth/auth/authorisation/users/views.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/gn_auth/auth/authorisation/users/views.py b/gn_auth/auth/authorisation/users/views.py
index 50386ac..bbb220e 100644
--- a/gn_auth/auth/authorisation/users/views.py
+++ b/gn_auth/auth/authorisation/users/views.py
@@ -58,7 +58,8 @@ 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)))
+ {**role, "roles": tuple(dictify(rol) for rol in role["roles"])}
+ for role in _user_roles(conn, token.user)))
def validate_password(password, confirm_password) -> str:
"""Validate the provided password."""