From 065d97043611b0892dc56b813db87d943c67ec7d Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 29 Jul 2025 10:14:45 -0500 Subject: Deprecate older authorisation-checking functions. --- gn_auth/auth/authorisation/resources/checks.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'gn_auth/auth') 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, " -- cgit 1.4.1