mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Cascading permissions for .db download, closes #1058
This commit is contained in:
parent
c3aba4aa98
commit
7d9fedc176
3 changed files with 20 additions and 5 deletions
|
|
@ -131,9 +131,14 @@ class DatabaseDownload(DataView):
|
|||
name = "database_download"
|
||||
|
||||
async def view_get(self, request, database, hash, correct_hash_present, **kwargs):
|
||||
await self.check_permission(request, "view-instance")
|
||||
await self.check_permission(request, "view-database", database)
|
||||
await self.check_permission(request, "view-database-download", database)
|
||||
await self.check_permissions(
|
||||
request,
|
||||
[
|
||||
("view-database-download", database),
|
||||
("view-database", database),
|
||||
"view-instance",
|
||||
],
|
||||
)
|
||||
if database not in self.ds.databases:
|
||||
raise DatasetteError("Invalid database", status=404)
|
||||
db = self.ds.databases[database]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue