Add specific permissions for edit/delete of individual batch rows

This commit is contained in:
Lance Edgar 2016-09-30 15:20:40 -05:00
parent f59e75072e
commit 3bafa41ecd

View file

@ -1184,10 +1184,14 @@ class MasterView(View):
if cls.has_rows and cls.rows_editable: if cls.has_rows and cls.rows_editable:
config.add_route('{}.edit'.format(row_route_prefix), '{}/{{uuid}}/edit'.format(row_url_prefix)) config.add_route('{}.edit'.format(row_route_prefix), '{}/{{uuid}}/edit'.format(row_url_prefix))
config.add_view(cls, attr='edit_row', route_name='{}.edit'.format(row_route_prefix), config.add_view(cls, attr='edit_row', route_name='{}.edit'.format(row_route_prefix),
permission='{}.edit'.format(permission_prefix)) permission='{}.edit_row'.format(permission_prefix))
config.add_tailbone_permission(permission_prefix, '{}.edit_row'.format(permission_prefix),
"Edit individual {} rows".format(model_title))
# delete row # delete row
if cls.has_rows and cls.rows_deletable: if cls.has_rows and cls.rows_deletable:
config.add_route('{}.delete'.format(row_route_prefix), '{}/{{uuid}}/delete'.format(row_url_prefix)) config.add_route('{}.delete'.format(row_route_prefix), '{}/{{uuid}}/delete'.format(row_url_prefix))
config.add_view(cls, attr='delete_row', route_name='{}.delete'.format(row_route_prefix), config.add_view(cls, attr='delete_row', route_name='{}.delete'.format(row_route_prefix),
permission='{}.edit'.format(permission_prefix)) permission='{}.delete_row'.format(permission_prefix))
config.add_tailbone_permission(permission_prefix, '{}.delete_row'.format(permission_prefix),
"Delete individual {} rows".format(model_title))