diff options
author | Frederick Muriuki Muriithi | 2025-07-29 10:14:45 -0500 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2025-07-29 10:15:13 -0500 |
commit | 065d97043611b0892dc56b813db87d943c67ec7d (patch) | |
tree | 4ea8f5e480364325b0c3fc672307475bc084645b | |
parent | 164137c5ce1a7a7e2e8144cd44d49220b543c2ee (diff) | |
download | gn-auth-065d97043611b0892dc56b813db87d943c67ec7d.tar.gz |
Deprecate older authorisation-checking functions.
-rw-r--r-- | gn_auth/auth/authorisation/resources/checks.py | 7 |
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, " |