about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-07-29 10:14:45 -0500
committerFrederick Muriuki Muriithi2025-07-29 10:15:13 -0500
commit065d97043611b0892dc56b813db87d943c67ec7d (patch)
tree4ea8f5e480364325b0c3fc672307475bc084645b
parent164137c5ce1a7a7e2e8144cd44d49220b543c2ee (diff)
downloadgn-auth-065d97043611b0892dc56b813db87d943c67ec7d.tar.gz
Deprecate older authorisation-checking functions.
-rw-r--r--gn_auth/auth/authorisation/resources/checks.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/gn_auth/auth/authorisation/resources/checks.py b/gn_auth/auth/authorisation/resources/checks.py
index ddd95b9..eb8afbd 100644
--- a/gn_auth/auth/authorisation/resources/checks.py
+++ b/gn_auth/auth/authorisation/resources/checks.py
@@ -1,5 +1,6 @@
 """Handle authorisation checks for resources"""
 import uuid
+import warnings
 from functools import reduce
 from typing import Sequence
 
@@ -31,6 +32,9 @@ def authorised_for(conn: db.DbConnection,
     Check whether `user` is authorised to access `resources` according to given
     `privileges`.
     """
+    warnings.warn(DeprecationWarning(
+        f"The function `{__name__}.authorised_for` is deprecated. Please use "
+        f"`{__name__}.authorised_for_spec`"))
     with db.cursor(conn) as cursor:
         cursor.execute(
             ("SELECT ur.*, rp.privilege_id FROM "
@@ -63,6 +67,9 @@ def authorised_for2(
     """
     Check that `user` has **ALL** the specified privileges for the resource.
     """
+    warnings.warn(DeprecationWarning(
+        f"The function `{__name__}.authorised_for2` is deprecated. Please use "
+        f"`{__name__}.authorised_for_spec`"))
     with db.cursor(conn) as cursor:
         _query = (
             "SELECT resources.resource_id, user_roles.user_id, roles.role_id, "