Skip to content

Commit

Permalink
Merge pull request #194 from bento-platform/fix/edit-dataset-perms-def
Browse files Browse the repository at this point in the history
fix(auth): don't allow data type narrowing in edit:dataset permission
  • Loading branch information
davidlougheed authored May 2, 2024
2 parents 4e0a77d + edb1275 commit 17ab2e0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
16 changes: 7 additions & 9 deletions bento_lib/auth/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@ def supports_data_type_narrowing(self) -> bool:
P_VIEW_NOTIFICATIONS = Permission(VIEW_VERB, NOTIFICATIONS)
P_CREATE_NOTIFICATIONS = Permission(CREATE_VERB, NOTIFICATIONS)

# - dataset metadata editing
P_EDIT_DATASET = Permission(EDIT_VERB, DATASET, supports_data_type_narrowing=False)

# - can view edit permissions for the resource which granted this permission only:
P_VIEW_PERMISSIONS = Permission(VIEW_VERB, PERMISSIONS_NOUN)
P_EDIT_PERMISSIONS = Permission(EDIT_VERB, PERMISSIONS_NOUN)

# ---

# only {everything: true} or {project: ...} (instance- or project-level):
Expand All @@ -177,15 +184,6 @@ def supports_data_type_narrowing(self) -> bool:
DELETE_VERB, DATASET, min_level_required=LEVEL_PROJECT, supports_data_type_narrowing=False, gives=(P_DELETE_DATA,))
# ---

# - dataset metadata editing
P_EDIT_DATASET = Permission(EDIT_VERB, DATASET)

# can view edit permissions for the resource which granted this permission only:
P_VIEW_PERMISSIONS = Permission(VIEW_VERB, PERMISSIONS_NOUN)
P_EDIT_PERMISSIONS = Permission(EDIT_VERB, PERMISSIONS_NOUN)

# ---

# only {everything: true} (instance-level):

# - drop box
Expand Down
6 changes: 3 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.7.0"
version = "11.7.1"
description = "A set of common utilities and helpers for Bento platform services."
authors = [
"David Lougheed <[email protected]>",
Expand Down

0 comments on commit 17ab2e0

Please sign in to comment.