From fa87d16612ff671683f35ecc5f5e36af007599e4 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Tue, 9 Jun 2020 07:10:46 -0700 Subject: [PATCH] Clearer docs for actor_matches_allow --- datasette/utils/__init__.py | 3 ++- docs/authentication.rst | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/datasette/utils/__init__.py b/datasette/utils/__init__.py index d8cde95a..5873fcaa 100644 --- a/datasette/utils/__init__.py +++ b/datasette/utils/__init__.py @@ -867,7 +867,8 @@ async def async_call_with_supported_arguments(fn, **kwargs): def actor_matches_allow(actor, allow): - actor = actor or {} + if actor is None: + actor = {"anonymous": True} if allow is None: return True for key, values in allow.items(): diff --git a/docs/authentication.rst b/docs/authentication.rst index f7281db4..04564886 100644 --- a/docs/authentication.rst +++ b/docs/authentication.rst @@ -239,7 +239,7 @@ To limit this ability for just one specific database, use this: actor_matches_allow() ===================== -Plugins that wish to implement the same permissions scheme as canned queries can take advantage of the ``datasette.utils.actor_matches_allow(actor, allow)`` function: +Plugins that wish to implement this same ``"allow"`` block permissions scheme can take advantage of the ``datasette.utils.actor_matches_allow(actor, allow)`` function: .. code-block:: python