@lvdniet/strapi-plugin-vercel-deploy
Version:
Strapi v4 plugin to trigger and monitor a deployment on Vercel
25 lines (19 loc) • 569 B
JavaScript
;
const getPluginConfig = require("../helpers/pluginConfig");
module.exports = {
checkConfigRoles(policyContext, _, { strapi }) {
const pluginConfig = getPluginConfig(strapi);
/** @type {Array} */
const configRoles = pluginConfig("roles");
if (!configRoles || configRoles.length <= 0) {
return true;
}
/** @type {Array} */
const userRoles = policyContext.state.user.roles;
const hasRole = userRoles.find((r) => configRoles.includes(r.code));
if (hasRole) {
return true;
}
return false;
},
};