From eba868bae84398389f893d2e5c8a97a5534c19e5 Mon Sep 17 00:00:00 2001 From: Marco Capetta Date: Thu, 8 Aug 2024 18:21:23 +0200 Subject: [PATCH] MT#60674 Fix page permission for CE users After having added license check is some of the CSC pages we noticed that CSC call page cannot be accessed anymore by CE users. This commit fix this issue and also address a typo in the required license to access the fax pages. Change-Id: Ifc6cfa9b41cd53417da43f44a736076b82fcc9cb (cherry picked from commit bc1b4f3fbe91ef753b5fb66162e605d94a9b8e72) (cherry picked from commit 8e1b8bb6559c7853746a34f46894fd139c72dda4) --- src/boot/routes.js | 8 ++++++-- src/components/CscMainMenuTop.vue | 7 ++++--- src/router/routes.js | 2 +- src/store/user.js | 3 +++ 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/boot/routes.js b/src/boot/routes.js index 94c378c4..9f1906f2 100644 --- a/src/boot/routes.js +++ b/src/boot/routes.js @@ -36,8 +36,12 @@ export default ({ app, router, store }) => { if (to.meta?.profileAttribute) { const hasSubscriberProfileAttribute = store.getters['user/hasSubscriberProfileAttribute'](to.meta.profileAttribute) if (to.meta.license && hasSubscriberProfileAttribute) { - // Guard to assure that users cannot click on menu if - // it is mistakenly visible when the license is inactive + // Guard to assure that: + // CE users have access to all available menus as they do not have licenses + if (store.platformInfo.type === 'spce') { + next() + } + // users cannot click on menu if it is mistakenly visible when the license is inactive store.getters['user/isLicenseActive'](to.meta.license) ? next() : next('/') } diff --git a/src/components/CscMainMenuTop.vue b/src/components/CscMainMenuTop.vue index 0c30f85a..a6394a9e 100644 --- a/src/components/CscMainMenuTop.vue +++ b/src/components/CscMainMenuTop.vue @@ -51,7 +51,8 @@ export default { 'hasSubscriberProfileAttributes', 'isLicenseActive', 'isOldCSCProxyingAllowed', - 'isPbxEnabled' + 'isPbxEnabled', + 'isSpCe' ]), items () { return [ @@ -66,7 +67,7 @@ export default { icon: 'call', label: this.callStateTitle, sublabel: this.callStateSubtitle, - visible: this.hasSubscriberProfileAttribute(PROFILE_ATTRIBUTE_MAP.cscCalls) && this.isLicenseActive(LICENSES.csc_calls) + visible: this.hasSubscriberProfileAttribute(PROFILE_ATTRIBUTE_MAP.cscCalls && (this.isSpCe || this.isLicenseActive(LICENSES.csc_calls))) }, { to: '/user/conversations', @@ -138,7 +139,7 @@ export default { to: '/user/recordings', icon: 'play_circle', label: this.$t('Recordings'), - visible: this.hasSubscriberProfileAttribute(PROFILE_ATTRIBUTE_MAP.recordings) && this.isLicenseActive(LICENSES.call_recording) + visible: this.hasSubscriberProfileAttribute(PROFILE_ATTRIBUTE_MAP.recordings) && (this.isSpCe || this.isLicenseActive(LICENSES.call_recording)) } ] }, diff --git a/src/router/routes.js b/src/router/routes.js index 1e0d4ac4..8c70d6bd 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -434,7 +434,7 @@ const routes = [ return i18n.global.tc('Set your fax settings') }, profileAttribute: PROFILE_ATTRIBUTE_MAP.faxServer, - license: LICENSES.phonebook + license: LICENSES.fax } }, { diff --git a/src/store/user.js b/src/store/user.js index ba331a02..6669a281 100644 --- a/src/store/user.js +++ b/src/store/user.js @@ -210,6 +210,9 @@ export default { }, isPbxAttendant (state, getters) { return getters.isPbxPilot || getters.isPbxGroup || getters.isPbxSeat + }, + isSpCe (state) { + return state.platformInfo.type === 'spce' } }, mutations: {