2017-11-27 10:59:24 +01:00
|
|
|
const _ = require('lodash');
|
|
|
|
|
2017-11-24 15:15:02 +01:00
|
|
|
module.exports = strapi => {
|
|
|
|
return {
|
|
|
|
initialize: function(cb) {
|
2017-11-27 10:59:24 +01:00
|
|
|
_.forEach(strapi.config.routes, value => {
|
|
|
|
value.config.policies.unshift('plugins.users-permissions.isAuthenticated');
|
2017-11-24 15:15:02 +01:00
|
|
|
});
|
|
|
|
|
2017-11-27 10:59:24 +01:00
|
|
|
if (strapi.plugins) {
|
|
|
|
_.forEach(strapi.plugins, (plugin, name) => {
|
|
|
|
_.forEach(plugin.config.routes, value => {
|
|
|
|
value.config.policies.unshift('plugins.users-permissions.isAuthenticated');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-11-24 15:15:02 +01:00
|
|
|
cb();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|