From 7e09e1bf1b928eb259fd95394aa202abb8a98cc2 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Sat, 1 Nov 2025 19:30:56 -0700 Subject: [PATCH] Removed obsolete actor ID v.s. actor dict code, refs #2570 --- datasette/default_permissions.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/datasette/default_permissions.py b/datasette/default_permissions.py index 23c96a23..9afb088e 100644 --- a/datasette/default_permissions.py +++ b/datasette/default_permissions.py @@ -131,21 +131,13 @@ async def config_permissions_sql(datasette, actor, action): """Apply config-based permission rules from datasette.yaml.""" config = datasette.config or {} - if actor is None: - actor_dict: dict | None = None - elif isinstance(actor, dict): - actor_dict = actor - else: - actor_lookup = await datasette.actors_from_ids([actor]) - actor_dict = actor_lookup.get(actor) or {"id": actor} - def evaluate(allow_block): if allow_block is None: return None - return actor_matches_allow(actor_dict, allow_block) + return actor_matches_allow(actor, allow_block) - has_restrictions = actor_dict and "_r" in actor_dict if actor_dict else False - restrictions = actor_dict.get("_r", {}) if actor_dict else {} + has_restrictions = actor and "_r" in actor if actor else False + restrictions = actor.get("_r", {}) if actor else {} action_obj = datasette.actions.get(action) action_checks = {action}