Skip to content

Commit

Permalink
making workflow policies rdm enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
mesemus committed Feb 2, 2025
1 parent a75f01d commit 49feb2d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class WorkflowRecordPermissionPolicy(RecordPermissionPolicy):
@property
def query_filters(self) -> list[dict]:
"""Return query filters from the delegated workflow permissions."""
if not (self.action == "read" or self.action == "read_draft"):
if self.action not in ("read", "read_draft", "read_deleted"):
return super().query_filters
workflows = current_oarepo_workflows.record_workflows
queries = []
Expand Down
7 changes: 7 additions & 0 deletions oarepo_workflows/services/permissions/workflow_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ def __init__(self, action_name: str | None = None, **over: Any) -> None:
IfInState("draft", [RecordOwners()]),
IfInState("published", [AuthenticatedUser()]),
]
# can_read_deleted is used by RDM. As long as workflows are
# not intended for rdm records only, we need to keep this permission
# simple and the implementation must use RDM-based implementation
#
# TODO: we should provide somewhere RDM aware workflow permissions
# so that repositories can use them out of the box
can_read_deleted = [SystemProcess()]
can_update = [IfInState("draft", [RecordOwners()])]
can_delete = [
IfInState("draft", [RecordOwners()]),
Expand Down

0 comments on commit 49feb2d

Please sign in to comment.