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

Conversation

@nadilas
Copy link

@nadilas nadilas commented Jun 4, 2020

if (rules.generate === undefined && !Array.isArray(rules)) {

This line doesn't allow a router rule such as:

meta: {
    rule: '*'
}

to go through, It remains invalid, as it is not a predefined rule, which means this section let's it run through as a simple string:

vue-acl/source/mixin.js

Lines 36 to 40 in affd849

if (routePermission in globalRules) {
routePermission = globalRules[routePermission]
}
if (!testPermission(currentGlobal, routePermission)) {

not being an array and not having a .generate function.

Event if it got through, by using:

meta: {
    rule: new AclRule('*')
}

The result of .generate() is an array of an array: [['*']], hence the following line:

if (rule === '*') hasAllowed = true;
also fails.

Consider the mentioned simplification.

nadilas added 2 commits June 4, 2020 20:28
https://github.com/leonardovilarinho/vue-acl/blob/affd849636e24f00c5be6e83faa86d8d6bc9ffe8/source/checker.js#L9

This line doesn't allow a router rule such as:
```js
meta: {
    rule: '*'
}
```

to go through, It remains invalid, as it is not a predefined rule, which means this section let's it run through as a simple string:
https://github.com/leonardovilarinho/vue-acl/blob/affd849636e24f00c5be6e83faa86d8d6bc9ffe8/source/mixin.js#L36-L40

not being an array and not having a `.generate` function.

Event if it got through, by using:

```js
meta: {
    rule: new AclRule('*')
}
```

The result of `.generate()` is an array of an array: `[['*']]`, hence the following line: https://github.com/leonardovilarinho/vue-acl/blob/affd849636e24f00c5be6e83faa86d8d6bc9ffe8/source/checker.js#L19 also fails.

Consider the mentioned simplification.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant