mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Added permission check to every view, closes #808
This commit is contained in:
parent
bd4de0647d
commit
86dec9e8ff
13 changed files with 220 additions and 2 deletions
|
|
@ -840,3 +840,19 @@ if __name__ == "__main__":
|
|||
sys.argv[0]
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def assert_permission_checked(
|
||||
datasette, action, resource_type=None, resource_identifier=None
|
||||
):
|
||||
assert [
|
||||
pc
|
||||
for pc in datasette._permission_checks
|
||||
if pc["action"] == action
|
||||
and pc["resource_type"] == resource_type
|
||||
and pc["resource_identifier"] == resource_identifier
|
||||
], """Missing expected permission check: action={}, resource_type={}, resource_identifier={}
|
||||
Permission checks seen: {}
|
||||
""".format(
|
||||
action, resource_type, resource_identifier, datasette._permission_checks
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue