# oarepo\_config.workflows.low\_level

## `oarepo_config.workflows.low_level`

Configuration for workflows.

### `register_workflow(workflow_code: str, workflow_name: str | LazyString, permissions_policy: str | type, requests_policy: str | type, use_low_level_workflows: bool = False) -> None`

Register a submission/review workflow that records can go through.

A workflow defines the path a record takes from being created to being published - for example, who may create it, whether it needs review/approval before publishing, and who may perform each of those steps. This adds one such workflow to the repository, so that it can be selected when configuring where records may be submitted (e.g. a community).

This is a low-level, single-workflow building block. Repositories that use the community-based workflow shape provided by the `oarepo_app` package typically use its higher-level `configure_workflows(IndividualWorkflow(...), CommunityWorkflow(...))` helper instead - see this package's README for the difference.

Parameters:

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `workflow_code` | `str` | A short, unique identifier for the workflow, e.g. `"default"`. | *required* |
| `workflow_name` | `str \| LazyString` | The human-readable name of the workflow, shown to users, e.g. `_("Default workflow")`. | *required* |
| `permissions_policy` | `str \| type` | Who is allowed to do what with records that use this workflow (create, edit, delete, publish, ...). Pass either a permissions policy class or its import path as a string. | *required* |
| `requests_policy` | `str \| type` | What review/approval requests are available for records using this workflow (e.g. a publish request that needs a curator's approval). Pass either a request policy class or its import path as a string. | *required* |
| `use_low_level_workflows` | `bool` | Set to `True` to silence the warning recommending [`configure_workflows`](<https://oarepo.github.io/oarepo-config/reference/index.html#oarepo_config.configure_workflows> "configure_workflows(*workflow_definitions: BaseWorkflowSettings, default_individual_workflow: str = 'individual', default_community_workflow: str = 'community', context: dict \| None = None) -> list[Workflow]") instead, for the (uncommon) cases that genuinely need this low-level, single-workflow API. | `False` |

Requires the optional `oarepo_workflows` (and, for its defaults, `oarepo_requests`) package to be installed.

Invenio configuration variables set:

- `WORKFLOWS` - the new workflow is appended; workflows already registered (by earlier calls) are kept.
- `REQUESTS_PERMISSION_POLICY` - only if not already set by an earlier call; defaults to `oarepo_config.requests.RequestsPermissionPolicy` (workflow-based, plus creation of community-topic request types).

> [!NOTE]
>
> **Example**
>
> ```
> from oarepo_workflows.services.permissions import (
>     DefaultWorkflowPermissions,
> )
> from oarepo_requests.services.permissions.workflow_policies import (
>     CreatorsFromWorkflowRequestsPermissionPolicy,
> )
>
> config.register_workflow(
>     workflow_code="default",
>     workflow_name=_("Default workflow"),
>     permissions_policy=DefaultWorkflowPermissions,
>     requests_policy=CreatorsFromWorkflowRequestsPermissionPolicy,
> )
> ```
