@oniti/quasar-app-extension-vlank-auth 3.0.2 → 3.1.0

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 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oniti/quasar-app-extension-vlank-auth",
3
- "version": "3.0.2",
3
+ "version": "3.1.0",
4
4
  "description": "Authentification",
5
5
  "author": "François BOUYER <francois@oniti.fr>",
6
6
  "license": "MIT",
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" ? "checkAny" : "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["auth/checkAll"](rights)) {
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, onMounted } from 'vue'
55
+ import { ref, computed, watch } from 'vue'
56
56
  import { useRoute, useRouter } from 'vue-router'
57
57
  import { useStore } from 'vuex'
58
58
  import { useQuasar } from 'quasar'
@@ -5,6 +5,7 @@ export function SET_AUTH(state,user){
5
5
  export function SET_LOGOUT(state){
6
6
  state.user = null
7
7
  state.logged = false
8
+ state.has_check = false
8
9
  }
9
10
 
10
11
  export function HAS_CHECK_AUTH ( state ) {