mirror of
https://github.com/strapi/strapi.git
synced 2025-09-22 14:59:07 +00:00
18 lines
321 B
JavaScript
18 lines
321 B
JavaScript
'use strict';
|
|
|
|
const {
|
|
contentTypes: { hasDraftAndPublish },
|
|
} = require('@strapi/utils');
|
|
|
|
module.exports = (ctx, { strapi }) => {
|
|
const { model: modelUID } = ctx.params;
|
|
|
|
const model = strapi.contentTypes[modelUID];
|
|
|
|
if (!hasDraftAndPublish(model)) {
|
|
throw strapi.errors.forbidden();
|
|
}
|
|
|
|
return true;
|
|
};
|