chore(docs): extend contributor docs by RBAC for stages

This commit is contained in:
Gustav Hansen 2023-09-13 13:01:40 +02:00
parent 3f47fb9e30
commit f385aa6c8c
2 changed files with 30 additions and 1 deletions

View File

@ -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:

View File

@ -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<void>,
}
```
### 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;
}