From a0bb481a4399283042c8514c9478bb348c127370 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 3 Jan 2022 15:34:00 -0600 Subject: [PATCH] Use `AuthHandler.get_permissions()` instead of deprecated `cache_permissions()` --- tailbone/api/auth.py | 4 ++-- tailbone/subscribers.py | 9 +-------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/tailbone/api/auth.py b/tailbone/api/auth.py index 80f8fac0..c4d04b90 100644 --- a/tailbone/api/auth.py +++ b/tailbone/api/auth.py @@ -2,7 +2,7 @@ ################################################################################ # # Rattail -- Retail Software Framework -# Copyright © 2010-2021 Lance Edgar +# Copyright © 2010-2022 Lance Edgar # # This file is part of Rattail. # @@ -89,7 +89,7 @@ class AuthenticationView(APIView): return { 'ok': True, 'user': self.get_user_info(user), - 'permissions': list(auth.cache_permissions(Session(), user)), + 'permissions': list(auth.get_permissions(Session(), user)), } def authenticate_user(self, username, password): diff --git a/tailbone/subscribers.py b/tailbone/subscribers.py index 150aa6da..44b69247 100644 --- a/tailbone/subscribers.py +++ b/tailbone/subscribers.py @@ -89,15 +89,8 @@ def new_request(event): if rattail_config: app = rattail_config.get_app() auth = app.get_auth_handler() - request.tailbone_cached_permissions = auth.cache_permissions( + request.tailbone_cached_permissions = auth.get_permissions( Session(), request.user) - # TODO: until we know otherwise, let's assume this is not needed - # else: - # # TODO: not sure why this would really work, or even be - # # needed, if there was no rattail config? - # from rattail.db.auth import cache_permissions - # request.tailbone_cached_permissions = cache_permissions( - # Session(), request.user) def before_render(event):