Skip to content
This repository has been archived by the owner on Oct 23, 2020. It is now read-only.

checker update #90

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions source/checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,19 @@
* @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)) {
rules = rules.generate();
}

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)) {
Expand Down