oarepo_config.workflows.simplified.base
oarepo_config.workflows.simplified.base
Base workflow settings and helpers for OARepo workflow configuration.
BaseWorkflowSettings
dataclass
Shared configuration common to all workflow types.
Source code in oarepo_config/workflows/simplified/base.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
code: str = 'undefined'
class-attribute
instance-attribute
The code of the workflow type.
label: LazyString = _('Undefined policy')
class-attribute
instance-attribute
The label of the workflow type.
base_permission_policy: type[Any] = DefaultRDMWorkflowPermissions
class-attribute
instance-attribute
The base permission policy class for this workflow that will be configured.
base_request_policy: type[WorkflowRequestPolicy] = WorkflowRequestPolicy
class-attribute
instance-attribute
The base requests policy class for this workflow that will be configured.
review_request_states: list[str] = dataclasses.field(default_factory=lambda: ['draft'])
class-attribute
instance-attribute
Record workflow states in which a review request may be submitted.
record_view_permissions: dict[str, list[Generator]] = dataclasses.field(default_factory=dict)
class-attribute
instance-attribute
View permissions for records in this workflow.
It is a dictionary, the key is record state and the value is a list of generators.
publish_after_review: bool = True
class-attribute
instance-attribute
Publish immediately after reviewer approves the review request.
extra_permissions: type[BasePermissionPolicy] | Callable[[type[BasePermissionPolicy]], type[BasePermissionPolicy]] | None = None
class-attribute
instance-attribute
Extra permissions to apply to the record permission policy.
If a callable is provided, it will be called with the generated permission policy as an argument and should return a modified permission policy. If a class is provided, it will be used as a mixin for the generated permission policy.
extra_requests: type[WorkflowRequestPolicy] | Callable[[type[WorkflowRequestPolicy]], type[WorkflowRequestPolicy]] | None = None
class-attribute
instance-attribute
Extra requests to apply to the workflow request policy.
If a callable is provided, it will be called with the generated request policy as an argument and should return a modified request policy. If a class is provided, it will be used as a mixin for the generated request policy.
authenticated_draft_creation: bool = False
class-attribute
instance-attribute
Allow authenticated users to create draft records.
When enabled and no role- or need-based restrictions are configured, any
authenticated user may create a draft. Subclasses may override this
default (e.g. IndividualWorkflow sets it to True).
draft_creation_roles: list[str] = dataclasses.field(default_factory=list)
class-attribute
instance-attribute
Restrict draft creation to users who hold at least one of these site-wide roles.
When non-empty, takes priority over authenticated_draft_creation.
draft_creation_needs: list[str] = dataclasses.field(default_factory=list)
class-attribute
instance-attribute
Restrict draft creation to users who hold at least one of these permission needs.
When non-empty, takes priority over authenticated_draft_creation.
build_workflow() -> Workflow
Build and return the workflow instance.
Source code in oarepo_config/workflows/simplified/base.py
add_if_in_state(states: list[str], generators: tuple[Generator, ...] | list[Generator]) -> list[Generator]
Wrap generators in an IfInState constraint when states are provided.
If states is non-empty, returns a single-element list containing an
IfInState generator that
activates generators only when the record is in one of the listed states.
If states is empty the generators are returned unchanged as a plain list.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
states
|
list[str]
|
Workflow state names that gate the generators. Pass an empty list to apply the generators unconditionally. |
required |
generators
|
tuple[Generator, ...] | list[Generator]
|
Permission generators to conditionally wrap. |
required |
Returns:
| Type | Description |
|---|---|
list[Generator]
|
A list of generators, optionally wrapped in an |
list[Generator]
|
constraint. |