From bc7137abfef9c9a5f25c7feb6edbf8c8ee930529 Mon Sep 17 00:00:00 2001 From: Victor Klomp Date: Mon, 21 Oct 2024 10:51:52 +0200 Subject: [PATCH] feat(permissions): Permission based rendering for the point of sales --- apps/dashboard/src/components/TopNavbar.vue | 11 ++++++++--- .../src/components/container/ContainersCard.vue | 6 +++++- apps/dashboard/src/locales/en/common/common.json | 5 ++++- apps/dashboard/src/locales/nl/common/common.json | 5 ++++- .../seller/components/POSOverviewTable.vue | 8 +++++++- .../seller/components/POSSettingsCard.vue | 5 ++++- .../src/modules/seller/views/POSInfoView.vue | 14 +++++++++++++- .../src/modules/seller/views/POSOverviewView.vue | 12 +++++------- apps/dashboard/src/utils/permissionUtils.ts | 16 ++++++++-------- lib/common/src/stores/auth.store.ts | 3 +++ 10 files changed, 61 insertions(+), 24 deletions(-) diff --git a/apps/dashboard/src/components/TopNavbar.vue b/apps/dashboard/src/components/TopNavbar.vue index 0a107b6a..cf1862ba 100644 --- a/apps/dashboard/src/components/TopNavbar.vue +++ b/apps/dashboard/src/components/TopNavbar.vue @@ -152,12 +152,13 @@ const navItems = computed(() => [ }, { label: t('common.navigation.admin'), - visible: isAllowed('get', ['all'], 'User', ['any']), + visible: isAllowed('update', ['all'], 'User', ['any']) + || isAllowed('get', ['all'], 'Banner', ['any']), items: [ { label: t('common.navigation.userOverview'), route: '/user-overview', - visible: isAllowed('get', ['all'], 'User', ['any']), + visible: isAllowed('update', ['all'], 'User', ['any']), }, { label: t('common.navigation.banners'), @@ -169,6 +170,10 @@ const navItems = computed(() => [ { label: t('common.navigation.financial'), notifications: getFinancialNotifications(), + visible: isAllowed('update', ['all'], 'User', ['any']) + || isAllowed('get', ['all'], 'Invoice', ['any']) + || isAllowed('get', ['all'], 'Fine', ['any']) + || isAllowed('get', ['all'], 'SellerPayout', ['any']), items: [ { label: t('common.navigation.userOverview'), @@ -207,7 +212,7 @@ const navItems = computed(() => [ label: t('common.navigation.posOverview'), route: '/point-of-sale/overview', // TODO: Change to `action: get` after https://github.com/GEWIS/sudosos-backend/issues/62 is fully finished - visible: isAllowed('update', ['own', 'organ'], 'PointOfSale', ['any']), + visible: isAllowed('get', ['own', 'organ'], 'PointOfSale', ['any']), }, ...organs.value, ] diff --git a/apps/dashboard/src/components/container/ContainersCard.vue b/apps/dashboard/src/components/container/ContainersCard.vue index 492a6fa6..64ae34e5 100644 --- a/apps/dashboard/src/components/container/ContainersCard.vue +++ b/apps/dashboard/src/components/container/ContainersCard.vue @@ -3,7 +3,7 @@