@oniti/quasar-app-extension-vlank-auth 3.0.1 → 3.1.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 +1 -0
- package/package.json +1 -1
- package/src/boot/index.js +6 -1
- package/src/components/pages/PasswordReset.vue +1 -1
package/README.md
CHANGED
|
@@ -76,6 +76,7 @@ Route example:
|
|
|
76
76
|
| passwordLostRoute | Override default "passwordLostRoute" route |
|
|
77
77
|
| passwordCreateRoute | Override default "passwordCreateRoute" route |
|
|
78
78
|
| rights | array of required rights, a message will pop if **any** right is missing! |
|
|
79
|
+
| typeRightCheck | string, "any" or "all" define if all rights are requiered or only one |
|
|
79
80
|
| logoutOnUnsufisantRights | self explaining :) |
|
|
80
81
|
|
|
81
82
|
## Helpers
|
package/package.json
CHANGED
package/src/boot/index.js
CHANGED
|
@@ -38,6 +38,11 @@ export default boot(({ app, router, store }) => {
|
|
|
38
38
|
let rights = to.matched.find((r) => r.meta.rights);
|
|
39
39
|
rights = rights ? rights.meta.rights : [];
|
|
40
40
|
|
|
41
|
+
let typeRightCheck = to.matched.find((r) => r.meta.typeRightCheck);
|
|
42
|
+
typeRightCheck = typeRightCheck ? typeRightCheck.meta.typeRightCheck : "all";
|
|
43
|
+
|
|
44
|
+
const getter_right_check = typeRightCheck === "any" ? "auth/checkAny" : "auth/checkAll";
|
|
45
|
+
|
|
41
46
|
let logoutOnUnsufisantRights = to.matched.find((r) =>
|
|
42
47
|
r.meta.hasOwnProperty("logoutOnUnsufisantRights")
|
|
43
48
|
);
|
|
@@ -52,7 +57,7 @@ export default boot(({ app, router, store }) => {
|
|
|
52
57
|
// eslint-disable-next-line
|
|
53
58
|
if (store.getters["auth/isAuthenticated"]) {
|
|
54
59
|
// Pas les droits nécéssaires
|
|
55
|
-
if (!store.getters[
|
|
60
|
+
if (!store.getters[getter_right_check](rights)) {
|
|
56
61
|
if (logoutOnUnsufisantRights) {
|
|
57
62
|
store.dispatch("auth/logout");
|
|
58
63
|
next(helper.getLoginRoute());
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
</template>
|
|
53
53
|
|
|
54
54
|
<script setup>
|
|
55
|
-
import { ref, computed, watch, inject } from 'vue'
|
|
55
|
+
import { ref, computed, watch, inject, onMounted } from 'vue'
|
|
56
56
|
import { useRoute, useRouter } from 'vue-router'
|
|
57
57
|
import { useStore } from 'vuex'
|
|
58
58
|
import { useQuasar } from 'quasar'
|