From c8ec13d1307e606f107de76dbd22cc2109a403ef Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 26 Nov 2016 21:22:57 -0600 Subject: [PATCH] Add permission for bulk-delete of batch data rows --- tailbone/views/batch/core.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tailbone/views/batch/core.py b/tailbone/views/batch/core.py index 9fbc73a6..6f2fd812 100644 --- a/tailbone/views/batch/core.py +++ b/tailbone/views/batch/core.py @@ -373,7 +373,7 @@ class BatchMasterView(MasterView): return HTML.tag('p', c=link) def make_batch_row_grid_tools(self, batch): - if not batch.executed and self.request.has_perm('{}.edit'.format(self.get_permission_prefix())): + if not batch.executed and self.request.has_perm('{}.delete_rows'.format(self.get_permission_prefix())): url = self.request.route_url('{}.delete_rows'.format(self.get_route_prefix()), uuid=batch.uuid) return HTML.tag('p', c=tags.link_to("Delete all rows matching current search", url)) @@ -856,7 +856,9 @@ class BatchMasterView(MasterView): # bulk delete rows config.add_route('{}.delete_rows'.format(route_prefix), '{}/{{uuid}}/rows/delete'.format(url_prefix)) config.add_view(cls, attr='bulk_delete_rows', route_name='{}.delete_rows'.format(route_prefix), - permission='{}.edit'.format(permission_prefix)) + permission='{}.delete_rows'.format(permission_prefix)) + config.add_tailbone_permission(permission_prefix, '{}.delete_rows'.format(permission_prefix), + "Bulk-delete data rows from {}".format(model_title)) # execute batch config.add_route('{}.execute'.format(route_prefix), '{}/{{uuid}}/execute'.format(url_prefix))