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.

This commit is contained in:
依瑪貓 2023-02-07 16:58:46 +08:00
parent 2d3b9f68b8
commit c67ed4471c

View File

@ -103,5 +103,5 @@ def init_app(app: Flask, can_view_func: t.Callable[[], bool] | None = None,
__can_view_func = can_view_func __can_view_func = can_view_func
if can_edit_func is not None: if can_edit_func is not None:
__can_edit_func = can_edit_func __can_edit_func = can_edit_func
app.jinja_env.globals["can_view_accounting"] = __can_view_func app.jinja_env.globals["can_view_accounting"] = can_view
app.jinja_env.globals["can_edit_accounting"] = __can_edit_func app.jinja_env.globals["can_edit_accounting"] = can_edit