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