Skip to content

Commit

Permalink
Merge pull request #181 from bento-platform/feat/auth/permissions-props
Browse files Browse the repository at this point in the history
feat(auth): add verb/noun access properties to Permission
  • Loading branch information
davidlougheed authored Feb 8, 2024
2 parents 5d36538 + eeab525 commit 4be4ec4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions bento_lib/auth/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ def _str_form(cls, verb: PermissionVerb, noun: PermissionNoun) -> str:
def __repr__(self):
return f"Permission({str(self)})"

@property
def verb(self) -> PermissionVerb:
return self._verb

@property
def noun(self) -> PermissionNoun:
return self._noun

@property
def gives(self) -> frozenset["Permission"]:
return self._gives
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "bento-lib"
version = "11.4.1"
version = "11.5.0"
description = "A set of common utilities and helpers for Bento platform services."
authors = [
"David Lougheed <[email protected]>",
Expand Down
2 changes: 2 additions & 0 deletions tests/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ def test_permissions_equality():
assert P_QUERY_DATA != P_DELETE_DATA
assert P_QUERY_DATA != "a"
assert P_QUERY_DATA != 5
assert P_QUERY_DATA.verb == QUERY_VERB
assert P_QUERY_DATA.noun == DATA


def test_permissions_repr():
Expand Down

0 comments on commit 4be4ec4

Please sign in to comment.