In-memory _schemas database tracking schemas of attached tables, closes #1150

This commit is contained in:
Simon Willison 2020-12-18 14:34:05 -08:00
commit ebc7aa287c
8 changed files with 279 additions and 6 deletions

View file

@ -13,6 +13,8 @@ def permission_allowed(datasette, actor, action, resource):
if allow is not None:
return actor_matches_allow(actor, allow)
elif action == "view-database":
if resource == "_schemas" and (actor is None or actor.get("id") != "root"):
return False
database_allow = datasette.metadata("allow", database=resource)
if database_allow is None:
return None