You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
532 B
15 lines
532 B
import { PermissionModule } from '@/store/modules/permission'
|
|
|
|
export function checkPermission(value: string[]): boolean {
|
|
if (value && value instanceof Array && value.length > 0) {
|
|
const permissions = PermissionModule.authorizedPermissions
|
|
const permissionRoles = value
|
|
const hasPermission = permissions.some(permission => {
|
|
return permissionRoles.includes(permission)
|
|
})
|
|
return hasPermission
|
|
} else {
|
|
console.error('need roles! Like v-permission="[\'admin\',\'editor\']"')
|
|
return false
|
|
}
|
|
}
|
|
|