about summary refs log tree commit diff
diff options
context:
space:
mode:
authorClaude Sonnet 4.62026-09-02 19:21:29 +0000
committerFrederick Muriuki Muriithi2026-09-02 14:31:41 -0500
commitae212d4acf1e80d117bc9fb7692605a19721a41b (patch)
treef735de99dd9772de2a6474792093d3593deedbca
parent1cf8351219ebf59bdec38dff741c726deb2bb368 (diff)
downloadgn-auth-ae212d4acf1e80d117bc9fb7692605a19721a41b.tar.gz
refactor(system/views): remove dead deprecation-check code HEAD main
The /auth/system/roles endpoint has no active blueprint registration —
the system Blueprint is only reachable via /auth/resource/system/roles.
The `if "/resource/" not in request.path` branch could never fire, so
remove it along with _SUCCESSOR, and the warnings import.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Reviewed-By: Frederick M. Muriithi <fredmanglis@gmail.com>
-rw-r--r--gn_auth/auth/authorisation/resources/system/views.py23
1 files changed, 8 insertions, 15 deletions
diff --git a/gn_auth/auth/authorisation/resources/system/views.py b/gn_auth/auth/authorisation/resources/system/views.py
index 23ea6e9..54aa086 100644
--- a/gn_auth/auth/authorisation/resources/system/views.py
+++ b/gn_auth/auth/authorisation/resources/system/views.py
@@ -1,8 +1,12 @@
 """Views relating to `System` resource(s)."""
 import logging
-import warnings
 from dataclasses import asdict
-from flask import request, jsonify, Blueprint, make_response, current_app as app
+from flask import (request,
+                   jsonify,
+                   Response,
+                   Blueprint,
+                   make_response,
+                   current_app as app)
 
 from gn_libs import sqlite3 as authdb
 
@@ -14,11 +18,9 @@ from .models import user_roles_on_system
 logger = logging.getLogger(__name__)
 system = Blueprint("system", __name__)
 
-_SUCCESSOR = "/auth/resource/system/roles"
-
 
 @system.route("/roles")
-def system_roles():
+def system_roles() -> Response:
     """Get the roles that a user has that act on the system."""
     with (authdb.connection(app.config["AUTH_DB"]) as conn,
           authdb.cursor(conn) as cursor):
@@ -36,13 +38,4 @@ def system_roles():
                     asdict(role) for role in
                     user_roles_on_system(conn, the_token.user))
 
-    resp = make_response(jsonify(roles_data))
-    if "/resource/" not in request.path:
-        resp.headers["Deprecation"] = "true"
-        resp.headers["Link"] = f'<{_SUCCESSOR}>; rel="successor-version"'
-        warnings.warn(
-            ("The endpoint `/auth/system/roles` is deprecated -- please use "
-             "`/auth/resource/system/roles` instead."),
-            category=DeprecationWarning,
-            stacklevel=2)
-    return resp
+    return make_response(jsonify(roles_data), 200)