mirror of
https://github.com/strapi/strapi.git
synced 2025-07-17 14:02:21 +00:00
18 lines
401 B
JavaScript
18 lines
401 B
JavaScript
'use strict';
|
|
|
|
const { yup, formatYupErrors } = require('@strapi/utils');
|
|
|
|
const hasPermissionsSchema = yup.array().of(yup.string());
|
|
|
|
const validateHasPermissionsInput = actions => {
|
|
try {
|
|
return hasPermissionsSchema.validateSync(actions, { strict: true, abortEarly: true });
|
|
} catch (e) {
|
|
throw new Error(formatYupErrors(e));
|
|
}
|
|
};
|
|
|
|
module.exports = {
|
|
validateHasPermissionsInput,
|
|
};
|