Add permission for bulk-delete of batch data rows

This commit is contained in:
Lance Edgar 2016-11-26 21:22:57 -06:00
parent 139d9a4fed
commit c8ec13d130

View file

@ -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))