@strapi/review-workflows 0.0.0-experimental.afa3b513b8f95459043f33fb94f4bac03af1474f → 0.0.0-experimental.bb39175992a5cd205a7e3f2e13a96aa31eba2cff
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{Layout-D5aa9iUm.mjs → Layout-BJOxxAeM.mjs} +2 -2
- package/dist/_chunks/{Layout-D5aa9iUm.mjs.map → Layout-BJOxxAeM.mjs.map} +1 -1
- package/dist/_chunks/{Layout-AREWDuuq.js → Layout-DnEAvmeU.js} +2 -2
- package/dist/_chunks/{Layout-AREWDuuq.js.map → Layout-DnEAvmeU.js.map} +1 -1
- package/dist/_chunks/{_id-DDNHKV_W.mjs → _id-6LK95-rZ.mjs} +6 -6
- package/dist/_chunks/{_id-DDNHKV_W.mjs.map → _id-6LK95-rZ.mjs.map} +1 -1
- package/dist/_chunks/{_id-C7pCAzXV.js → _id-DSDzUpwX.js} +6 -6
- package/dist/_chunks/_id-DSDzUpwX.js.map +1 -0
- package/dist/_chunks/{index-Bv3cQ3c-.js → index-6FZL88pd.js} +8 -28
- package/dist/_chunks/index-6FZL88pd.js.map +1 -0
- package/dist/_chunks/{index-CIBLMG85.js → index-DZSLya4b.js} +25 -19
- package/dist/_chunks/index-DZSLya4b.js.map +1 -0
- package/dist/_chunks/{index-CeaoNBIP.mjs → index-Df1alkCk.mjs} +10 -30
- package/dist/_chunks/index-Df1alkCk.mjs.map +1 -0
- package/dist/_chunks/{index-Cx5QECZI.mjs → index-lJqpw8bs.mjs} +25 -19
- package/dist/_chunks/index-lJqpw8bs.mjs.map +1 -0
- package/dist/_chunks/{router-gRPIa2_c.js → router-CZqe-02r.js} +3 -3
- package/dist/_chunks/{router-gRPIa2_c.js.map → router-CZqe-02r.js.map} +1 -1
- package/dist/_chunks/{router-BEoNwQZ1.mjs → router-DeSH-NeW.mjs} +3 -3
- package/dist/_chunks/{router-BEoNwQZ1.mjs.map → router-DeSH-NeW.mjs.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +23 -8
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +23 -8
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/controllers/assignees.d.ts.map +1 -1
- package/dist/server/src/controllers/stages.d.ts.map +1 -1
- package/package.json +8 -8
- package/dist/_chunks/_id-C7pCAzXV.js.map +0 -1
- package/dist/_chunks/index-Bv3cQ3c-.js.map +0 -1
- package/dist/_chunks/index-CIBLMG85.js.map +0 -1
- package/dist/_chunks/index-CeaoNBIP.mjs.map +0 -1
- package/dist/_chunks/index-Cx5QECZI.mjs.map +0 -1
package/dist/server/index.js
CHANGED
|
@@ -6901,7 +6901,7 @@ const reviewWorkflows = {
|
|
|
6901
6901
|
{
|
|
6902
6902
|
name: "admin::hasPermissions",
|
|
6903
6903
|
config: {
|
|
6904
|
-
actions: ["admin::users.read"
|
|
6904
|
+
actions: ["admin::users.read"]
|
|
6905
6905
|
}
|
|
6906
6906
|
}
|
|
6907
6907
|
]
|
|
@@ -8116,10 +8116,9 @@ const stages = {
|
|
|
8116
8116
|
if (strapi.plugin("content-manager").service("permission-checker").create({ userAbility: ctx.state.userAbility, model: modelUID }).cannot.read()) {
|
|
8117
8117
|
return ctx.forbidden();
|
|
8118
8118
|
}
|
|
8119
|
-
const locale = await validateLocale(query?.locale);
|
|
8119
|
+
const locale = await validateLocale(query?.locale) ?? void 0;
|
|
8120
8120
|
const entity = await strapi.documents(modelUID).findOne({
|
|
8121
8121
|
documentId,
|
|
8122
|
-
// @ts-expect-error - locale should be also null in the doc service types
|
|
8123
8122
|
locale,
|
|
8124
8123
|
populate: [ENTITY_STAGE_ATTRIBUTE]
|
|
8125
8124
|
});
|
|
@@ -8128,12 +8127,13 @@ const stages = {
|
|
|
8128
8127
|
}
|
|
8129
8128
|
const entityStageId = entity[ENTITY_STAGE_ATTRIBUTE]?.id;
|
|
8130
8129
|
const canTransition = stagePermissions2.can(STAGE_TRANSITION_UID, entityStageId);
|
|
8131
|
-
const [workflowCount,
|
|
8130
|
+
const [workflowCount, workflowResult] = await Promise.all([
|
|
8132
8131
|
workflowService.count(),
|
|
8133
8132
|
workflowService.getAssignedWorkflow(modelUID, {
|
|
8134
8133
|
populate: "stages"
|
|
8135
8134
|
})
|
|
8136
8135
|
]);
|
|
8136
|
+
const workflowStages = workflowResult ? workflowResult.stages : [];
|
|
8137
8137
|
const meta = {
|
|
8138
8138
|
stageCount: workflowStages.length,
|
|
8139
8139
|
workflowCount
|
|
@@ -8169,22 +8169,37 @@ const assignees = {
|
|
|
8169
8169
|
async updateEntity(ctx) {
|
|
8170
8170
|
const assigneeService = getService("assignees");
|
|
8171
8171
|
const workflowService = getService("workflows");
|
|
8172
|
+
const stagePermissions2 = getService("stage-permissions");
|
|
8172
8173
|
const { model_uid: model, id: documentId } = ctx.params;
|
|
8173
|
-
const
|
|
8174
|
+
const locale = await validateLocale(ctx.request.query?.locale) ?? void 0;
|
|
8174
8175
|
const { sanitizeOutput } = strapi.plugin("content-manager").service("permission-checker").create({ userAbility: ctx.state.userAbility, model });
|
|
8176
|
+
const entity = await strapi.documents(model).findOne({
|
|
8177
|
+
documentId,
|
|
8178
|
+
locale,
|
|
8179
|
+
populate: [ENTITY_STAGE_ATTRIBUTE]
|
|
8180
|
+
});
|
|
8181
|
+
if (!entity) {
|
|
8182
|
+
ctx.throw(404, "Entity not found");
|
|
8183
|
+
}
|
|
8184
|
+
const canTransitionStage = stagePermissions2.can(
|
|
8185
|
+
STAGE_TRANSITION_UID,
|
|
8186
|
+
entity[ENTITY_STAGE_ATTRIBUTE]?.id
|
|
8187
|
+
);
|
|
8188
|
+
if (!canTransitionStage) {
|
|
8189
|
+
ctx.throw(403, "Stage transition permission is required");
|
|
8190
|
+
}
|
|
8175
8191
|
const { id: assigneeId } = await validateUpdateAssigneeOnEntity(
|
|
8176
8192
|
ctx.request?.body?.data,
|
|
8177
8193
|
"You should pass a valid id to the body of the put request."
|
|
8178
8194
|
);
|
|
8179
|
-
await validateLocale(locale);
|
|
8180
8195
|
await workflowService.assertContentTypeBelongsToWorkflow(model);
|
|
8181
|
-
const
|
|
8196
|
+
const updatedEntity = await assigneeService.updateEntityAssignee(
|
|
8182
8197
|
documentId,
|
|
8183
8198
|
locale || null,
|
|
8184
8199
|
model,
|
|
8185
8200
|
assigneeId
|
|
8186
8201
|
);
|
|
8187
|
-
ctx.body = { data: await sanitizeOutput(
|
|
8202
|
+
ctx.body = { data: await sanitizeOutput(updatedEntity) };
|
|
8188
8203
|
}
|
|
8189
8204
|
};
|
|
8190
8205
|
const controllers = {
|