Use AuthHandler.get_permissions()
instead of deprecated `cache_permissions()`
This commit is contained in:
parent
3aac855fa1
commit
a0bb481a43
|
@ -2,7 +2,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Rattail -- Retail Software Framework
|
# Rattail -- Retail Software Framework
|
||||||
# Copyright © 2010-2021 Lance Edgar
|
# Copyright © 2010-2022 Lance Edgar
|
||||||
#
|
#
|
||||||
# This file is part of Rattail.
|
# This file is part of Rattail.
|
||||||
#
|
#
|
||||||
|
@ -89,7 +89,7 @@ class AuthenticationView(APIView):
|
||||||
return {
|
return {
|
||||||
'ok': True,
|
'ok': True,
|
||||||
'user': self.get_user_info(user),
|
'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):
|
def authenticate_user(self, username, password):
|
||||||
|
|
|
@ -89,15 +89,8 @@ def new_request(event):
|
||||||
if rattail_config:
|
if rattail_config:
|
||||||
app = rattail_config.get_app()
|
app = rattail_config.get_app()
|
||||||
auth = app.get_auth_handler()
|
auth = app.get_auth_handler()
|
||||||
request.tailbone_cached_permissions = auth.cache_permissions(
|
request.tailbone_cached_permissions = auth.get_permissions(
|
||||||
Session(), request.user)
|
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):
|
def before_render(event):
|
||||||
|
|
Loading…
Reference in a new issue