Remove permission_allowed hook entirely, refs #2528

The permission_allowed hook has been fully replaced by permission_resources_sql.
This commit removes:
- hookspec definition from hookspecs.py
- 4 implementations from default_permissions.py
- implementations from test plugins (my_plugin.py, my_plugin_2.py)
- hook monitoring infrastructure from conftest.py
- references from fixtures.py
- Also fixes test_get_permission to use ds.get_action() instead of ds.get_permission()
- Removes 5th column (source_plugin) from PermissionSQL queries

This completes the migration to the SQL-based permission system.
This commit is contained in:
Simon Willison 2025-10-25 08:52:48 -07:00
commit 5feb5fcf5d
7 changed files with 23 additions and 159 deletions

View file

@ -145,7 +145,7 @@ def check_permission_actions_are_documented():
)
def before(hook_name, hook_impls, kwargs):
if hook_name == "permission_allowed":
if hook_name == "permission_resources_sql":
datasette = kwargs["datasette"]
assert kwargs["action"] in datasette.actions, (
"'{}' has not been registered with register_actions()".format(
@ -156,9 +156,7 @@ def check_permission_actions_are_documented():
action = kwargs.get("action").replace("-", "_")
assert (
action in documented_permission_actions
), "Undocumented permission action: {}, resource: {}".format(
action, kwargs["resource"]
)
), "Undocumented permission action: {}".format(action)
pm.add_hookcall_monitoring(
before=before, after=lambda outcome, hook_name, hook_impls, kwargs: None