Skip to content

Commit

Permalink
Don't crash on actor with no id, closes #21
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Sep 1, 2024
1 parent 5a3f327 commit 4bc4787
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion datasette_acl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ def clear_expired(self):


async def update_dynamic_groups(datasette, actor, skip_cache=False):
if not actor or not actor.get("id"):
return
if (not skip_cache) and one_second_cache.get(actor["id"]):
# Don't do this more than once a second per actor
return
Expand Down Expand Up @@ -291,7 +293,7 @@ def permission_allowed(datasette, actor, action, resource):
return None

async def inner():
if not actor:
if not actor or not actor.get("id"):
return None
await update_dynamic_groups(
datasette, actor, skip_cache=hasattr(sys, "_pytest_running")
Expand Down

0 comments on commit 4bc4787

Please sign in to comment.