diff --git a/src/stores/utils/index.ts b/src/stores/utils/index.ts index 5eed9e96..3b39f872 100644 --- a/src/stores/utils/index.ts +++ b/src/stores/utils/index.ts @@ -3,6 +3,7 @@ import GlobalDialog from 'components/GlobalDialog.vue'; import { ComposerTranslation, useI18n } from 'vue-i18n'; import { defineStore } from 'pinia'; import { Ref, ref } from 'vue'; +import { getRole } from 'src/services/keycloak'; export const baseUrl = import.meta.env.VITE_API_BASE_URL; @@ -218,4 +219,11 @@ const useUtilsStore = defineStore('utilsStore', () => { }; }); +export function isRoleInclude(role2check: string[]): boolean { + const roles = getRole() ?? []; + const isIncluded = role2check.some((r) => roles.includes(r)); + + return isIncluded; +} + export default useUtilsStore;