From d57d13f3b82b5c981c4cadf0b74a0583a1535250 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 22 Sep 2023 07:51:20 +0300 Subject: 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. --- gn_auth/auth/authorisation/users/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gn_auth/auth/authorisation/users') 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.""" -- cgit v1.2.3