unauthenticated: true method plus allow block docs, closes #825

This commit is contained in:
Simon Willison 2020-06-09 10:01:03 -07:00
commit 7633b9ab24
6 changed files with 134 additions and 55 deletions

View file

@ -867,10 +867,11 @@ async def async_call_with_supported_arguments(fn, **kwargs):
def actor_matches_allow(actor, allow):
if actor is None:
actor = {"anonymous": True}
if actor is None and allow and allow.get("unauthenticated") is True:
return True
if allow is None:
return True
actor = actor or {}
for key, values in allow.items():
if values == "*" and key in actor:
return True