@oniti/quasar-app-extension-vlank-auth 3.2.1 → 3.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -1
- package/package.json +1 -1
- package/src/boot/index.js +2 -1
package/README.md
CHANGED
|
@@ -46,7 +46,20 @@ chainWebpack(chain) {
|
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
```
|
|
49
|
-
|
|
49
|
+
### Configuration Optional
|
|
50
|
+
```javascript
|
|
51
|
+
framework:{
|
|
52
|
+
...,
|
|
53
|
+
config:{
|
|
54
|
+
onitiVlankAuth: {
|
|
55
|
+
check_route_access_overide: (user, to) =>{
|
|
56
|
+
return false
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
...
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
50
63
|
### Usage
|
|
51
64
|
Just add requieresAuth as meta on route to require an auth.
|
|
52
65
|
|
package/package.json
CHANGED
package/src/boot/index.js
CHANGED
|
@@ -42,6 +42,7 @@ export default boot(({ app, router, store }) => {
|
|
|
42
42
|
typeRightCheck = typeRightCheck ? typeRightCheck.meta.typeRightCheck : "all";
|
|
43
43
|
|
|
44
44
|
const getter_right_check = typeRightCheck === "any" ? "auth/checkAny" : "auth/checkAll";
|
|
45
|
+
const check_route_access_overide = config.check_route_access_overide;
|
|
45
46
|
|
|
46
47
|
let logoutOnUnsufisantRights = to.matched.find((r) =>
|
|
47
48
|
r.meta.hasOwnProperty("logoutOnUnsufisantRights")
|
|
@@ -57,7 +58,7 @@ export default boot(({ app, router, store }) => {
|
|
|
57
58
|
// eslint-disable-next-line
|
|
58
59
|
if (store.getters["auth/isAuthenticated"]) {
|
|
59
60
|
// Pas les droits nécéssaires
|
|
60
|
-
if (!store.getters[getter_right_check](rights)) {
|
|
61
|
+
if ((check_route_access_overide && check_route_access_overide(store.getters['user'],to)) || (!check_route_access_overide &&!store.getters[getter_right_check](rights))) {
|
|
61
62
|
if (logoutOnUnsufisantRights) {
|
|
62
63
|
store.dispatch("auth/logout");
|
|
63
64
|
next(helper.getLoginRoute());
|