From e478df43ec07cb7409cd11cbe0bd7717cfd7c045 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Wed, 19 Aug 2026 13:02:54 -0500 Subject: Fetch role by ID rather than by user and ID. --- gn_auth/auth/authorisation/roles/views.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'gn_auth/auth') diff --git a/gn_auth/auth/authorisation/roles/views.py b/gn_auth/auth/authorisation/roles/views.py index 00def89..dda6f87 100644 --- a/gn_auth/auth/authorisation/roles/views.py +++ b/gn_auth/auth/authorisation/roles/views.py @@ -7,7 +7,7 @@ from flask import jsonify, Response, Blueprint, current_app from ...db import sqlite3 as db -from .models import user_role +from .models import role_by_id from ...authentication.oauth2.resource_server import require_oauth @@ -22,6 +22,4 @@ def view_role(role_id: uuid.UUID) -> Response: with require_oauth.acquire("profile role") as the_token: db_uri = current_app.config["AUTH_DB"] with db.connection(db_uri) as conn: - the_role = user_role(conn, the_token.user, role_id) - return the_role.either( - __error__, lambda a_role: jsonify((asdict(a_role[0]), str(a_role[1])))) + return jsonify(asdict(role_by_id(conn, role_id))) -- cgit 1.4.1