diff --git a/source/checker.js b/source/checker.js index 6f5c749..772f2ac 100644 --- a/source/checker.js +++ b/source/checker.js @@ -6,8 +6,12 @@ * @return {boolean} valided rule */ export const testPermission =(current, rules) => { + if (rule === '*') { + return true; + } + if (rules.generate === undefined && !Array.isArray(rules)) { - return console.error('[vue-acl] you have invalid rules'); + return console.error('[vue-acl] you have invalid rules: ' + JSON.stringify(rules)); } if (!Array.isArray(rules)) { @@ -15,12 +19,6 @@ export const testPermission =(current, rules) => { } let hasAllowed = false; - rules.forEach((rule) => { - if (rule === '*') hasAllowed = true; - }); - - if (hasAllowed) return true; - let checkAnds; // If current rule is an array then use the Array.prototype.include if (Array.isArray(current)) {