feat: function in role include
This commit is contained in:
parent
709c98e08c
commit
4899688740
1 changed files with 8 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue