2021-02-02 21:32:23 +00:00
|
|
|
import { useMainStore } from 'src/store';
|
2020-11-06 00:17:04 +00:00
|
|
|
|
2021-01-30 05:19:43 +00:00
|
|
|
export function hasPermission(permission: string) {
|
2021-02-02 21:32:23 +00:00
|
|
|
const store = useMainStore();
|
|
|
|
return store.permissions.includes(permission);
|
2020-11-06 00:17:04 +00:00
|
|
|
}
|
|
|
|
|
2021-01-30 05:19:43 +00:00
|
|
|
export function hasPermissions(needed: string[]) {
|
2021-02-02 21:32:23 +00:00
|
|
|
const store = useMainStore();
|
|
|
|
return needed.every((value) => store.permissions.includes(value));
|
2020-11-06 00:17:04 +00:00
|
|
|
}
|
2021-01-29 01:29:27 +00:00
|
|
|
|
2021-01-30 05:19:43 +00:00
|
|
|
export function hasSomePermissions(needed: string[]) {
|
2021-02-02 21:32:23 +00:00
|
|
|
const store = useMainStore();
|
|
|
|
return needed.some((value) => store.permissions.includes(value));
|
2021-01-29 01:29:27 +00:00
|
|
|
}
|