diff --git a/docs/docs/docs/01-core/admin/01-ee/01-review-workflows.md b/docs/docs/docs/01-core/admin/01-ee/01-review-workflows.md index ab416c6024..1174beaa52 100644 --- a/docs/docs/docs/01-core/admin/01-ee/01-review-workflows.md +++ b/docs/docs/docs/01-core/admin/01-ee/01-review-workflows.md @@ -113,6 +113,10 @@ This route updates the stages associated with a specific workflow identified by This route updates the stage of a specific entity identified by the id parameter and belonging to a specific collection identified by the model_uid parameter. The new stage value is passed in the request body. +#### GET `/content-manager/(collection|single)-types/:model_uid/:id/stages` + +Returns a list of stages that a user has permission to transition into (based on the permission settings of a stage). + ### Services The Review Workflow feature of the Enterprise Edition includes several services to manipulate workflows and stages. Here is a list of those services: diff --git a/docs/docs/docs/01-core/admin/03-settings/01-review-workflows.mdx b/docs/docs/docs/01-core/admin/03-settings/01-review-workflows.mdx index cd4cabda71..502dc9abd0 100644 --- a/docs/docs/docs/01-core/admin/03-settings/01-review-workflows.mdx +++ b/docs/docs/docs/01-core/admin/03-settings/01-review-workflows.mdx @@ -50,6 +50,12 @@ attribute will be re-ordered and not created. Stages without an `id` property will be created in the database on submission. Stages that existed already, but are not submitted again will be deleted on submission. +When editing a workflow and the `permissions` of a stage have not been modified by a user, they are sent as `undefined`. This special case allows users to edit a workflow without having to have +permissions to read `roles`, because the API won't update anything in the database. + +Users without read permissions for roles are able to create workflows, but they will not be able to define which roles can change a stage, so that stages of that workflow can only be changed +by the super-admin unless the roles are set. + ### Edit view Displays a license-limits modal in case the user is above the license limit on page load and upon form submission. @@ -74,7 +80,7 @@ hooks returns a partial react-query result. ```ts useReviewWorkflows(queryParams: object): { - meta: { workflowCount: int } + meta: { workflowCount: number } workflows: Workflow[], isLoading: boolean, status: string, @@ -82,6 +88,24 @@ useReviewWorkflows(queryParams: object): { } ``` +#### `useReviewWorkflowsStages({ id, layout }, reactQueryOptions)` + +This hook allows to fetch stages for a given workflow, that a user has permissions to transition to. + +```ts +type ContentTypeLayout { + uid: string; + kind: 'collectionType' | 'singleType'; +} + +useReviewWorkflowsStages({ id: number, layout: ContentTypeLayout }, reactQueryOptions): { + meta: { workflowCount: number, stagesCount: number } + stages: Stage[], + isLoading: boolean, + refetch: () => Promise, +} +``` + ### Data shapes ```ts @@ -89,6 +113,7 @@ type Stage { id: number; color: string; // hex code name: string; // max-length: 255 characters + permissions: Permission[]; createdAt: Date; updatedAt: Date; }