mirror of
https://github.com/strapi/strapi.git
synced 2025-11-02 02:44:55 +00:00
Do not load Grant middleware without user API
This commit is contained in:
parent
0609ce7a6c
commit
3bd7d2ea4b
@ -28,15 +28,16 @@ module.exports = function (strapi) {
|
||||
*/
|
||||
|
||||
initialize: function (cb) {
|
||||
_.defaultsDeep(strapi.api.user.config.grant, {
|
||||
server: {
|
||||
protocol: strapi.config.ssl ? 'https' : 'http',
|
||||
host: strapi.config.host + ':' + strapi.config.port
|
||||
}
|
||||
});
|
||||
const grant = new Grant(strapi.api.user.config.grant);
|
||||
|
||||
strapi.app.use(strapi.middlewares.mount(grant));
|
||||
if (_.isPlainObject(strapi.api.user)) {
|
||||
_.defaultsDeep(strapi.api.user.config.grant, {
|
||||
server: {
|
||||
protocol: strapi.config.ssl ? 'https' : 'http',
|
||||
host: strapi.config.host + ':' + strapi.config.port
|
||||
}
|
||||
});
|
||||
const grant = new Grant(strapi.api.user.config.grant);
|
||||
strapi.app.use(strapi.middlewares.mount(grant));
|
||||
}
|
||||
|
||||
cb();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user