From 27ea21bc770bc99a421b54d8f7a9fe5991fde9c0 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 24 Aug 2022 18:44:25 +0000 Subject: [PATCH] Restrict superuser, eval mode offer bizadmin once it exists so evaluators can see all the things now restricted to superuser --- ayanova/src/api/initialize.js | 101 +++++++++++++++++--------------- ayanova/src/store.js | 3 + ayanova/src/views/cust-user.vue | 2 +- ayanova/src/views/login.vue | 9 ++- 4 files changed, 65 insertions(+), 50 deletions(-) diff --git a/ayanova/src/api/initialize.js b/ayanova/src/api/initialize.js index e24fecb9..149636ea 100644 --- a/ayanova/src/api/initialize.js +++ b/ayanova/src/api/initialize.js @@ -29,6 +29,7 @@ function initNavPanel() { const licenseState = window.$gz.store.state.globalSettings.licenseStatus; const useInventory = window.$gz.store.state.globalSettings.useInventory; const licenseLockout = window.$gz.store.state.l; + const isSu = window.$gz.store.getters.isSuperUser == true; /*Service = 1, NotService = 2, Customer = 3, @@ -211,28 +212,30 @@ function initNavPanel() { //####### HOME GROUP if (!licenseLockout) { //DASHBOARD - sub.push({ - title: "Dashboard", - icon: "$ayiTachometer", - route: "/home-dashboard", - key: key++ - }); + if (!isSu) { + sub.push({ + title: "Dashboard", + icon: "$ayiTachometer", + route: "/home-dashboard", + key: key++ + }); - //SEARCH - sub.push({ - title: "Search", - icon: "$ayiSearch", - route: "/home-search", - key: key++ - }); + //SEARCH + sub.push({ + title: "Search", + icon: "$ayiSearch", + route: "/home-search", + key: key++ + }); - //SCHEDULE (personal) - sub.push({ - title: "Schedule", - icon: "$ayiCalendarDay", - route: "/home-schedule", - key: key++ - }); + //SCHEDULE (personal) + sub.push({ + title: "Schedule", + icon: "$ayiCalendarDay", + route: "/home-schedule", + key: key++ + }); + } //MEMOS sub.push({ @@ -242,22 +245,23 @@ function initNavPanel() { key: key++ }); - //REMINDERS - sub.push({ - title: "ReminderList", - icon: "$ayiStickyNote", - route: "/home-reminders", - key: key++ - }); - - //REVIEWS - sub.push({ - title: "ReviewList", - icon: "$ayiCalendarCheck", - route: "/home-reviews", - key: key++ - }); + if (!isSu) { + //REMINDERS + sub.push({ + title: "ReminderList", + icon: "$ayiStickyNote", + route: "/home-reminders", + key: key++ + }); + //REVIEWS + sub.push({ + title: "ReviewList", + icon: "$ayiCalendarCheck", + route: "/home-reviews", + key: key++ + }); + } //USER SETTINGS sub.push({ title: "UserSettings", @@ -265,15 +269,15 @@ function initNavPanel() { route: "/home-user-settings", key: key++ }); - - //USER NOTIFICATION SUBSCRIPTIONS - sub.push({ - title: "NotifySubscriptionList", - icon: "$ayiBullhorn", - route: "/home-notify-subscriptions", - key: key++ - }); - + if (!isSu) { + //USER NOTIFICATION SUBSCRIPTIONS + sub.push({ + title: "NotifySubscriptionList", + icon: "$ayiBullhorn", + route: "/home-notify-subscriptions", + key: key++ + }); + } //HISTORY / MRU / ACTIVITY (personal) sub.push({ title: "History", @@ -291,7 +295,7 @@ function initNavPanel() { } //######### CUSTOMER GROUP - if (window.$gz.role.canOpen(window.$gz.type.Customer)) { + if (window.$gz.role.canOpen(window.$gz.type.Customer) && !isSu) { //these all require Customer rights so all in the same block //clear sublevel array @@ -430,6 +434,7 @@ function initNavPanel() { //**** Service (TOP GROUP) if ( sub.length > 0 && + !isSu && !window.$gz.role.hasRole([ window.$gz.role.AUTHORIZATION_ROLES.TechRestricted ]) @@ -522,12 +527,12 @@ function initNavPanel() { } //**** INVENTORY (TOP GROUP) - if (sub.length > 0) { + if (sub.length > 0 && !isSu) { addNavItem("Inventory", "$ayiDolly", undefined, sub, key++, "inventory"); } //######### VENDORS (TOP GROUP) - if (window.$gz.role.canOpen(window.$gz.type.Vendor)) { + if (window.$gz.role.canOpen(window.$gz.type.Vendor) && !isSu ) { addNavItem("VendorList", "$ayiStore", "/vendors", [], key++, "vendor"); } @@ -584,7 +589,7 @@ function initNavPanel() { } // ** ACCOUNTING (TOP) - if (sub.length > 0) { + if (sub.length > 0 && !isSu) { addNavItem( "Accounting", "$ayiCoins", diff --git a/ayanova/src/store.js b/ayanova/src/store.js index ab22f44f..6dee2185 100644 --- a/ayanova/src/store.js +++ b/ayanova/src/store.js @@ -88,6 +88,9 @@ export default new Vuex.Store({ return false; } return false; + }, + isSuperUser: state => { + return state.userId === 1; } }, mutations: { diff --git a/ayanova/src/views/cust-user.vue b/ayanova/src/views/cust-user.vue index 69734e22..221cfc71 100644 --- a/ayanova/src/views/cust-user.vue +++ b/ayanova/src/views/cust-user.vue @@ -129,7 +129,7 @@ @click:append-outer="reveal = !reveal" > - +