diff options
| author | Frederick Muriuki Muriithi | 2026-08-19 13:02:54 -0500 |
|---|---|---|
| committer | Frederick Muriuki Muriithi | 2026-08-19 13:03:41 -0500 |
| commit | e478df43ec07cb7409cd11cbe0bd7717cfd7c045 (patch) | |
| tree | 38be8082a934ed41eb622910e24ecc818e36432a /gn_auth/auth | |
| parent | f4e385a35017f95c43549bb852d5cab594796a6f (diff) | |
| download | gn-auth-e478df43ec07cb7409cd11cbe0bd7717cfd7c045.tar.gz | |
Fetch role by ID rather than by user and ID.
Diffstat (limited to 'gn_auth/auth')
| -rw-r--r-- | gn_auth/auth/authorisation/roles/views.py | 6 |
1 files changed, 2 insertions, 4 deletions
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))) |
