mirror of
https://github.com/strapi/strapi.git
synced 2025-07-21 16:10:18 +00:00
26 lines
638 B
JavaScript
26 lines
638 B
JavaScript
const _ = require('lodash');
|
||
|
||
module.exports = strapi => {
|
||
return {
|
||
beforeInitialize: function() {
|
||
strapi.config.middleware.load.before.unshift('users-permissions');
|
||
},
|
||
|
||
initialize: function(cb) {
|
||
_.forEach(strapi.config.routes, value => {
|
||
value.config.policies.unshift('plugins.users-permissions.permissions');
|
||
});
|
||
|
||
if (strapi.plugins) {
|
||
_.forEach(strapi.plugins, (plugin, name) => {
|
||
_.forEach(plugin.config.routes, value => {
|
||
value.config.policies.unshift('plugins.users-permissions.permissions');
|
||
});
|
||
});
|
||
}
|
||
|
||
cb();
|
||
}
|
||
};
|
||
};
|