Fix policies detection

This commit is contained in:
Jim Laurie 2017-09-04 16:22:28 +02:00
parent 54c7f03c31
commit 23584dc7c1
2 changed files with 4 additions and 4 deletions

View File

@ -16,7 +16,7 @@ module.exports = (api, controller) => {
}
if (_.isObject(controller) && controller.hasOwnProperty('identity')) {
controller = controller.identity;
controller = controller.identity.toLowerCase();
} else if (_.isString(controller)) {
controller = controller.toLowerCase();
} else {

View File

@ -88,7 +88,7 @@ module.exports = strapi => function routerChecker(value, endpoint, plugin) {
} else if (
_.startsWith(policy, pluginPolicyPrefix, 0) &&
strapi.plugins[policySplited[1]] &&
!_.isEmpty(
!_.isUndefined(
_.get(
strapi.plugins,
policySplited[1] +
@ -109,7 +109,7 @@ module.exports = strapi => function routerChecker(value, endpoint, plugin) {
} else if (
!_.startsWith(policy, globalPolicyPrefix, 0) &&
plugin &&
!_.isEmpty(
!_.isUndefined(
_.get(
strapi.plugins,
plugin + '.config.policies.' + policy.toLowerCase()
@ -125,7 +125,7 @@ module.exports = strapi => function routerChecker(value, endpoint, plugin) {
);
} else if (
!_.startsWith(policy, globalPolicyPrefix, 0) &&
!_.isEmpty(
!_.isUndefined(
_.get(
strapi.api,
currentApiName + '.config.policies.' + policy.toLowerCase()