diff --git a/package.json b/package.json index ef8c7311..aa0c933a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "store-admin", - "version": "5.3.0", + "version": "5.3.1", "private": true, "description": "Admin panel for Heseya Store API", "author": "Heseya", diff --git a/src/components/root/DesktopNavigation.vue b/src/components/root/DesktopNavigation.vue index d78c19e9..090ef0ed 100644 --- a/src/components/root/DesktopNavigation.vue +++ b/src/components/root/DesktopNavigation.vue @@ -6,6 +6,7 @@ ({ activeItems: DEFAULT_MENU_ITEMS, @@ -13,6 +16,12 @@ const getters = getterTree(state, { (item: MenuItem) => item.type === MenuItemType.Link, ) as MenuLink[] }, + + items(state): MenuItem[] { + return state.activeItems.filter((item) => + `can` in item ? hasAccess(item.can || [])(accessor.auth.user?.permissions || []) : true, + ) + }, }) const mutations = mutationTree(state, { @@ -45,7 +54,8 @@ const actions = actionTree( async initMicrofrontendMenuItems({ dispatch, rootGetters }) { if (rootGetters['auth/isLogged']) { - await dispatch('apps/fetch', { limit: 500 }, { root: true }) + if (hasAccess(PERMISSIONS_TREE.Apps.Show)(accessor.auth.user?.permissions || [])) + await dispatch('apps/fetch', { limit: 500 }, { root: true }) dispatch('removeNotExistingApps') } }, diff --git a/src/views/settings/Index.vue b/src/views/settings/Index.vue index 60dfc830..1cca4a58 100644 --- a/src/views/settings/Index.vue +++ b/src/views/settings/Index.vue @@ -12,7 +12,7 @@ v-for="item in group" v-show="!isLinkHidden(item)" :key="item.id" - :v-can="item.can" + v-can="item.can" :name="$t(item.label).toString()" :url="item.to" :icon-class="item.iconClass"