From c67ed4471c5c153d82ae87160bccc746a6e9b579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Tue, 7 Feb 2023 16:58:46 +0800 Subject: [PATCH] Fixed the permission so that the template helper also use the wrapper can_view and can_edit, that can_edit always requires the user to log in first. --- src/accounting/utils/permission.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/accounting/utils/permission.py b/src/accounting/utils/permission.py index 6f25d6f..e978a86 100644 --- a/src/accounting/utils/permission.py +++ b/src/accounting/utils/permission.py @@ -103,5 +103,5 @@ def init_app(app: Flask, can_view_func: t.Callable[[], bool] | None = None, __can_view_func = can_view_func if can_edit_func is not None: __can_edit_func = can_edit_func - app.jinja_env.globals["can_view_accounting"] = __can_view_func - app.jinja_env.globals["can_edit_accounting"] = __can_edit_func + app.jinja_env.globals["can_view_accounting"] = can_view + app.jinja_env.globals["can_edit_accounting"] = can_edit