2020-11-06 00:17:04 +00:00
|
|
|
import { Store } from 'vuex';
|
|
|
|
import { StateInterface } from 'src/store';
|
|
|
|
|
2021-01-21 20:07:49 +00:00
|
|
|
export function hasPermission(permission: string, store: Store<StateInterface>) {
|
2020-11-06 00:17:04 +00:00
|
|
|
return store.state.user.currentPermissions.includes(permission);
|
|
|
|
}
|
|
|
|
|
|
|
|
export function hasPermissions(needed: string[], store: Store<StateInterface>) {
|
|
|
|
const permissions = store.state.user.currentPermissions;
|
|
|
|
return needed.every(value => permissions.includes(value));
|
|
|
|
}
|
2021-01-29 01:29:27 +00:00
|
|
|
|
|
|
|
export function hasSomePermissions(needed: string[], store: Store<StateInterface>) {
|
|
|
|
const permissions = store.state.user.currentPermissions;
|
|
|
|
return needed.some(value => permissions.includes(value));
|
|
|
|
}
|