Cascade for restricted token view-table/view-database/view-instance operations (#2154)

Closes #2102

* Permission is now a dataclass, not a namedtuple - refs https://github.com/simonw/datasette/pull/2154/#discussion_r1308087800
* datasette.get_permission() method
This commit is contained in:
Simon Willison 2023-08-29 09:32:34 -07:00 committed by GitHub
commit 50da908213
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 427 additions and 50 deletions

View file

@ -122,7 +122,17 @@ class PermissionsDebugView(BaseView):
# list() avoids error if check is performed during template render:
{
"permission_checks": list(reversed(self.ds._permission_checks)),
"permissions": list(self.ds.permissions.values()),
"permissions": [
(
p.name,
p.abbr,
p.description,
p.takes_database,
p.takes_resource,
p.default,
)
for p in self.ds.permissions.values()
],
},
)