Skip to content

Commit

Permalink
terminology changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mesemus committed Jul 31, 2024
1 parent 3957c52 commit d5d8944
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions oarepo_workflows/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
@dataclasses.dataclass
class Workflow:
label: str | LazyString
permissions_cls: Type[DefaultWorkflowPermissionPolicy]
requests_cls: Type[WorkflowRequestPolicy] = WorkflowRequestPolicy
permission_policy_cls: Type[DefaultWorkflowPermissionPolicy]
request_policy_cls: Type[WorkflowRequestPolicy] = WorkflowRequestPolicy

@property
def permissions(self):
return self.permissions_cls
def permissions(self, action, **over):
"""Return permission policy for this workflow applicable to the given action."""
return self.permission_policy_cls(action, **over)

@property
def requests(self):
return self.requests_cls()
"""Return instance of request policy for this workflow."""
return self.request_policy_cls()
8 changes: 4 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ class MyWorkflowRequests(WorkflowRequestPolicy):
WORKFLOWS = {
"my_workflow": Workflow(
label=_("Default workflow"),
permissions_cls=DefaultWorkflowPermissionPolicy,
requests_cls=MyWorkflowRequests,
permission_policy_cls=DefaultWorkflowPermissionPolicy,
request_policy_cls=MyWorkflowRequests,
),
"record_owners_can_read": Workflow(
label=_("Record owners read workflow"),
permissions_cls=RecordOwnersReadTestWorkflowPermissionPolicy,
requests_cls=MyWorkflowRequests,
permission_policy_cls=RecordOwnersReadTestWorkflowPermissionPolicy,
request_policy_cls=MyWorkflowRequests,
),
}

Expand Down

0 comments on commit d5d8944

Please sign in to comment.