From bdc57abd5a54384ed98e3d887d3c59c9249b8e3e Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 20 Aug 2024 17:02:38 -0500 Subject: [PATCH] fix: show CRUD buttons in header only if relevant and user has access --- src/wuttaweb/templates/base.mako | 68 ++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 30 deletions(-) diff --git a/src/wuttaweb/templates/base.mako b/src/wuttaweb/templates/base.mako index ce5e4ca..ffe903c 100644 --- a/src/wuttaweb/templates/base.mako +++ b/src/wuttaweb/templates/base.mako @@ -482,36 +482,44 @@ <%def name="render_crud_header_buttons()"> % if master: % if master.viewing: - - % if instance_deletable: - - % endif - % elif master.editing: - - % if instance_deletable: - - % endif - % elif master.deleting: - - + % if instance_editable and master.has_perm('edit'): + + % endif + % if instance_deletable and master.has_perm('delete'): + + % endif + % elif master.editing: + % if instance_viewable and master.has_perm('view'): + + % endif + % if instance_deletable and master.has_perm('delete'): + + % endif + % elif master.deleting: + % if instance_viewable and master.has_perm('view'): + + % endif + % if instance_editable and master.has_perm('edit'): + + % endif % endif % endif