This commit is contained in:
Your Name
2026-03-01 14:17:59 +08:00
parent 65aa12f146
commit a07e844c47
6071 changed files with 777651 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
import useUserStore from '@/stores/modules/user'
export const hasPermission = (perms: string[]): boolean => {
const userStore = useUserStore()
const permissions = userStore.perms
const all_permission = '*'
if (perms.length > 0) {
let hasPermission = true
perms.forEach((key: string) => {
if (!permissions.includes(key) && !permissions.includes(all_permission)) {
hasPermission = false
}
})
return hasPermission
} else {
return true
}
}