Skip to content

Commit

Permalink
Merge pull request #9 from oarepo/miroslavsimek/be-380-add-versioning…
Browse files Browse the repository at this point in the history
…-permission-on-default-workflow-permissions

Permissions for version search & create new version
  • Loading branch information
mesemus authored Aug 3, 2024
2 parents 49ff2df + 77a2bd1 commit f058970
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions oarepo_workflows/services/permissions/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class DefaultWorkflowPermissionPolicy(RecordPermissionPolicy):
"draft_read_files": "read_files",
"draft_update_files": "update_files",
"search_drafts": "search",
"search_versions": "search"
}

system_process = SystemProcess()
Expand All @@ -48,6 +49,7 @@ def __init__(self, action_name=None, **over):
]
can_create = [AuthenticatedUser()]
can_publish = [AuthenticatedUser()]
can_new_version = [AuthenticatedUser()]


class WorkflowPermissionPolicy(RecordPermissionPolicy):
Expand Down Expand Up @@ -76,6 +78,9 @@ class WorkflowPermissionPolicy(RecordPermissionPolicy):
can_draft_read_files = [WorkflowPermission("read_files")]
can_draft_update_files = [WorkflowPermission("update_files")]

can_new_version = [WorkflowPermission("new_version")]
can_search_versions = [SystemProcess(), AnyUser()]

@property
def query_filters(self):
if not (self.action == "read" or self.action == "read_draft"):
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = oarepo-workflows
version = 1.0.5
version = 1.0.6
description =
authors = Ronald Krist <[email protected]>
readme = README.md
Expand Down

0 comments on commit f058970

Please sign in to comment.