Skip to content

Commit

Permalink
chore(policy_engine): move out fn to prevent redef
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlougheed committed Nov 10, 2023
1 parent 17eba3c commit 6cc1801
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions bento_authorization_service/policy_engine/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,12 @@ def filter_matching_grants(
pass


def _permission_and_gives_from_string(p: str) -> Iterable[Permission]:
perm = PERMISSIONS_BY_STRING[p]
yield perm
yield from perm.gives


def determine_permissions(
grants: tuple[GrantModel, ...],
groups_dict: dict[int, StoredGroupModel],
Expand All @@ -303,11 +309,6 @@ def determine_permissions(
:return: The permissions frozen set
"""

def _permission_and_gives_from_string(p: str) -> Iterable[Permission]:
perm = PERMISSIONS_BY_STRING[p]
yield perm
yield from perm.gives

return frozenset(
itertools.chain.from_iterable(
_permission_and_gives_from_string(p)
Expand Down

0 comments on commit 6cc1801

Please sign in to comment.