From daf8d4ec95bb5d4a7e0c108c023f64d6954d70df Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 21 May 2026 10:32:52 -0500 Subject: Deprecate functions which duplicate those in gn-libs. The `gn_auth.auth.authorisation.resources.checks.can_[edit/delete]` functions duplicate the utility provided by similar named functions in the `gn_libs.privileges.resources` package. These ones are, thus, deprecated in favour of the gn-libs ones. --- gn_auth/auth/authorisation/resources/checks.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'gn_auth/auth/authorisation') diff --git a/gn_auth/auth/authorisation/resources/checks.py b/gn_auth/auth/authorisation/resources/checks.py index ca311ef..252df2f 100644 --- a/gn_auth/auth/authorisation/resources/checks.py +++ b/gn_auth/auth/authorisation/resources/checks.py @@ -135,6 +135,11 @@ def can_delete( resource_id: uuid.UUID ) -> bool: """Check whether user is allowed delete a resource and/or its data.""" + warnings.warn( + (f"Function '{__name__}.can_delete' is deprecated. " + "Use `gn_libs.privileges.resources.can_delete` instead."), + category=DeprecationWarning, + stacklevel=2) return ( authorised_for_spec(# resource-level delete access conn, @@ -155,6 +160,11 @@ def can_edit( resource_id: uuid.UUID ) -> bool: """Check whether user is allowed edit a resource and/or its data.""" + warnings.warn( + (f"Function '{__name__}.can_edit' is deprecated. " + "Use `gn_libs.privileges.resources.can_edit` instead."), + category=DeprecationWarning, + stacklevel=2) return ( authorised_for_spec( # resource-level edit access: user has edit access to his resource. -- cgit 1.4.1