From c9d6594750ad7a01b1e23af77e4f847e23f26306 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 27 Aug 2026 11:32:43 -0500 Subject: Deprecate endpoint /auth/resources//user/unassign. Prefer the endpoint `/auth/users/ Response: @require_oauth("profile group resource role") def unassign_role_to_user(resource_id: UUID) -> Response: """Unassign a role on the specified resource from a user.""" + warnings.warn( + f"The function `{__name__}.unassign_role_to_user` is deprecated. Please " + " use `gn_auth.auth.authorisation.users.views.revoke_user_role`", + DeprecationWarning, + stacklevel=2) with require_oauth.acquire("profile group resource role") as _token: try: form = request_json() @@ -385,7 +390,15 @@ def unassign_role_to_user(resource_id: UUID) -> Response: except AssertionError as aserr: raise AuthorisationError(aserr.args[0]) from aserr - return jsonify(with_db_connection(__assign__)) + new_uri = url_for( + "oauth2.users.revoke_user_role", + user_id=str(_token.user.user_id) + ).replace(str(_token.user.user_id), "") + return jsonify({ + **with_db_connection(__assign__), + "DeprecationWarning": ( + "This endpoint is deprecated and will be removed. Please use " + f"the {new_uri} endpoint.")}) def __public_view_params__(cursor, user_id, resource_id): ignore = (str(user_id),) -- cgit 1.4.1