allowed_resources(view-query, actor) fix

Previously we could not filter for canned queries that a
specific actor could view.
This commit is contained in:
Simon Willison 2026-03-18 09:05:23 -07:00
commit e800312b54
5 changed files with 75 additions and 9 deletions

View file

@ -1672,7 +1672,7 @@ async def test_hook_register_actions_with_custom_resources():
super().__init__(parent=collection, child=None)
@classmethod
async def resources_sql(cls, datasette) -> str:
async def resources_sql(cls, datasette, actor=None) -> str:
return """
SELECT 'collection1' AS parent, NULL AS child
UNION ALL
@ -1689,7 +1689,7 @@ async def test_hook_register_actions_with_custom_resources():
super().__init__(parent=collection, child=document)
@classmethod
async def resources_sql(cls, datasette) -> str:
async def resources_sql(cls, datasette, actor=None) -> str:
return """
SELECT 'collection1' AS parent, 'doc1' AS child
UNION ALL