Merge branch 'main' of https://github.com/vbenjs/vue-vben-admin
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@iconify/vue": "^4.1.2",
|
||||
"lucide-vue-next": "^0.435.0",
|
||||
"lucide-vue-next": "^0.436.0",
|
||||
"vue": "^3.4.38"
|
||||
}
|
||||
}
|
||||
|
@@ -36,7 +36,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@vben-core/shared": "workspace:*",
|
||||
"@vueuse/core": "^11.0.1",
|
||||
"@vueuse/core": "^11.0.3",
|
||||
"radix-vue": "^1.9.4",
|
||||
"sortablejs": "^1.15.2",
|
||||
"vue": "^3.4.38"
|
||||
|
@@ -31,7 +31,7 @@
|
||||
"dependencies": {
|
||||
"@vben-core/shared": "workspace:*",
|
||||
"@vben-core/typings": "workspace:*",
|
||||
"@vueuse/core": "^11.0.1",
|
||||
"@vueuse/core": "^11.0.3",
|
||||
"vue": "^3.4.38"
|
||||
}
|
||||
}
|
||||
|
@@ -41,7 +41,7 @@
|
||||
"@vben-core/icons": "workspace:*",
|
||||
"@vben-core/shadcn-ui": "workspace:*",
|
||||
"@vben-core/typings": "workspace:*",
|
||||
"@vueuse/core": "^11.0.1",
|
||||
"@vueuse/core": "^11.0.3",
|
||||
"vue": "^3.4.38"
|
||||
}
|
||||
}
|
||||
|
@@ -42,7 +42,7 @@
|
||||
"@vben-core/shadcn-ui": "workspace:*",
|
||||
"@vben-core/shared": "workspace:*",
|
||||
"@vben-core/typings": "workspace:*",
|
||||
"@vueuse/core": "^11.0.1",
|
||||
"@vueuse/core": "^11.0.3",
|
||||
"vue": "^3.4.38"
|
||||
}
|
||||
}
|
||||
|
@@ -41,7 +41,7 @@
|
||||
"@vben-core/icons": "workspace:*",
|
||||
"@vben-core/shadcn-ui": "workspace:*",
|
||||
"@vben-core/shared": "workspace:*",
|
||||
"@vueuse/core": "^11.0.1",
|
||||
"@vueuse/core": "^11.0.3",
|
||||
"vue": "^3.4.38"
|
||||
}
|
||||
}
|
||||
|
@@ -46,9 +46,9 @@
|
||||
"@vben-core/icons": "workspace:*",
|
||||
"@vben-core/shared": "workspace:*",
|
||||
"@vben-core/typings": "workspace:*",
|
||||
"@vueuse/core": "^11.0.1",
|
||||
"@vueuse/core": "^11.0.3",
|
||||
"class-variance-authority": "^0.7.0",
|
||||
"lucide-vue-next": "^0.435.0",
|
||||
"lucide-vue-next": "^0.436.0",
|
||||
"radix-vue": "^1.9.4",
|
||||
"vue": "^3.4.38"
|
||||
}
|
||||
|
@@ -41,7 +41,7 @@
|
||||
"@vben-core/icons": "workspace:*",
|
||||
"@vben-core/shadcn-ui": "workspace:*",
|
||||
"@vben-core/typings": "workspace:*",
|
||||
"@vueuse/core": "^11.0.1",
|
||||
"@vueuse/core": "^11.0.3",
|
||||
"vue": "^3.4.38"
|
||||
}
|
||||
}
|
||||
|
@@ -1,26 +1,30 @@
|
||||
/**
|
||||
* Global authority directive
|
||||
* Used for fine-grained control of component permissions
|
||||
* @Example v-auth="RoleEnum.TEST"
|
||||
* @Example v-access:role="[ROLE_NAME]" or v-access:role="ROLE_NAME"
|
||||
* @Example v-access:code="[ROLE_CODE]" or v-access:code="ROLE_CODE"
|
||||
*/
|
||||
import type { App, Directive, DirectiveBinding } from 'vue';
|
||||
|
||||
import { useAccess } from './use-access';
|
||||
|
||||
function isAccessible(el: Element, binding: any) {
|
||||
function isAccessible(
|
||||
el: Element,
|
||||
binding: DirectiveBinding<string | string[]>,
|
||||
) {
|
||||
const { accessMode, hasAccessByCodes, hasAccessByRoles } = useAccess();
|
||||
|
||||
const value = binding.value;
|
||||
|
||||
if (!value) {
|
||||
return;
|
||||
}
|
||||
if (!value) return;
|
||||
const authMethod =
|
||||
accessMode.value === 'frontend' && binding.arg === 'role'
|
||||
? hasAccessByRoles
|
||||
: hasAccessByCodes;
|
||||
|
||||
if (!authMethod(value)) {
|
||||
const values = Array.isArray(value) ? value : [value];
|
||||
|
||||
if (!authMethod(values)) {
|
||||
el?.remove();
|
||||
}
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@
|
||||
"@vben/icons": "workspace:*",
|
||||
"@vben/locales": "workspace:*",
|
||||
"@vben/types": "workspace:*",
|
||||
"@vueuse/integrations": "^11.0.1",
|
||||
"@vueuse/integrations": "^11.0.3",
|
||||
"qrcode": "^1.5.4",
|
||||
"vue": "^3.4.38",
|
||||
"vue-router": "^4.4.3"
|
||||
|
@@ -33,7 +33,7 @@
|
||||
"@vben/stores": "workspace:*",
|
||||
"@vben/types": "workspace:*",
|
||||
"@vben/utils": "workspace:*",
|
||||
"@vueuse/core": "^11.0.1",
|
||||
"@vueuse/core": "^11.0.3",
|
||||
"vue": "^3.4.38",
|
||||
"vue-router": "^4.4.3"
|
||||
}
|
||||
|
@@ -21,7 +21,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@vben/preferences": "workspace:*",
|
||||
"@vueuse/core": "^11.0.1",
|
||||
"@vueuse/core": "^11.0.3",
|
||||
"echarts": "^5.5.1",
|
||||
"vue": "^3.4.38"
|
||||
}
|
||||
|
Reference in New Issue
Block a user