Use AuthHandler.get_permissions()

instead of deprecated `cache_permissions()`
This commit is contained in:
Lance Edgar 2022-01-03 15:34:00 -06:00
parent 3aac855fa1
commit a0bb481a43
2 changed files with 3 additions and 10 deletions

View file

@ -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):

View file

@ -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):