flaschengeist-frontend/src/utils/permission.ts

15 lines
436 B
TypeScript
Raw Normal View History

import { Store } from 'vuex';
import { StateInterface } from 'src/store';
export function hasPermission(
permission: string,
store: Store<StateInterface>
) {
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));
}