新增
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user