Skip to content

Commit

Permalink
Fixed actor_matches_allow bug, closes #836
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Jun 11, 2020
1 parent 29c5ff4 commit f39f111
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion datasette/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ def actor_matches_allow(actor, allow):
values = [values]
actor_values = actor.get(key)
if actor_values is None:
return False
continue
if not isinstance(actor_values, list):
actor_values = [actor_values]
actor_values = set(actor_values)
Expand Down
2 changes: 2 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,8 @@ def test_multi_params(data, should_raise):
({"id": "garry", "roles": ["staff", "dev"]}, {"roles": ["dev", "otter"]}, True),
({"id": "garry", "roles": []}, {"roles": ["staff"]}, False),
({"id": "garry"}, {"roles": ["staff"]}, False),
# Any single matching key works:
({"id": "root"}, {"bot_id": "my-bot", "id": ["root"]}, True),
],
)
def test_actor_matches_allow(actor, allow, expected):
Expand Down

0 comments on commit f39f111

Please sign in to comment.