Restrict superuser, eval mode offer bizadmin once it exists so evaluators can see all the things now restricted to superuser

This commit is contained in:
2022-08-24 18:44:25 +00:00
parent 089ba29fbb
commit 27ea21bc77
4 changed files with 65 additions and 50 deletions

View File

@@ -29,6 +29,7 @@ function initNavPanel() {
const licenseState = window.$gz.store.state.globalSettings.licenseStatus; const licenseState = window.$gz.store.state.globalSettings.licenseStatus;
const useInventory = window.$gz.store.state.globalSettings.useInventory; const useInventory = window.$gz.store.state.globalSettings.useInventory;
const licenseLockout = window.$gz.store.state.l; const licenseLockout = window.$gz.store.state.l;
const isSu = window.$gz.store.getters.isSuperUser == true;
/*Service = 1, /*Service = 1,
NotService = 2, NotService = 2,
Customer = 3, Customer = 3,
@@ -211,6 +212,7 @@ function initNavPanel() {
//####### HOME GROUP //####### HOME GROUP
if (!licenseLockout) { if (!licenseLockout) {
//DASHBOARD //DASHBOARD
if (!isSu) {
sub.push({ sub.push({
title: "Dashboard", title: "Dashboard",
icon: "$ayiTachometer", icon: "$ayiTachometer",
@@ -233,6 +235,7 @@ function initNavPanel() {
route: "/home-schedule", route: "/home-schedule",
key: key++ key: key++
}); });
}
//MEMOS //MEMOS
sub.push({ sub.push({
@@ -242,6 +245,7 @@ function initNavPanel() {
key: key++ key: key++
}); });
if (!isSu) {
//REMINDERS //REMINDERS
sub.push({ sub.push({
title: "ReminderList", title: "ReminderList",
@@ -257,7 +261,7 @@ function initNavPanel() {
route: "/home-reviews", route: "/home-reviews",
key: key++ key: key++
}); });
}
//USER SETTINGS //USER SETTINGS
sub.push({ sub.push({
title: "UserSettings", title: "UserSettings",
@@ -265,7 +269,7 @@ function initNavPanel() {
route: "/home-user-settings", route: "/home-user-settings",
key: key++ key: key++
}); });
if (!isSu) {
//USER NOTIFICATION SUBSCRIPTIONS //USER NOTIFICATION SUBSCRIPTIONS
sub.push({ sub.push({
title: "NotifySubscriptionList", title: "NotifySubscriptionList",
@@ -273,7 +277,7 @@ function initNavPanel() {
route: "/home-notify-subscriptions", route: "/home-notify-subscriptions",
key: key++ key: key++
}); });
}
//HISTORY / MRU / ACTIVITY (personal) //HISTORY / MRU / ACTIVITY (personal)
sub.push({ sub.push({
title: "History", title: "History",
@@ -291,7 +295,7 @@ function initNavPanel() {
} }
//######### CUSTOMER GROUP //######### 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 //these all require Customer rights so all in the same block
//clear sublevel array //clear sublevel array
@@ -430,6 +434,7 @@ function initNavPanel() {
//**** Service (TOP GROUP) //**** Service (TOP GROUP)
if ( if (
sub.length > 0 && sub.length > 0 &&
!isSu &&
!window.$gz.role.hasRole([ !window.$gz.role.hasRole([
window.$gz.role.AUTHORIZATION_ROLES.TechRestricted window.$gz.role.AUTHORIZATION_ROLES.TechRestricted
]) ])
@@ -522,12 +527,12 @@ function initNavPanel() {
} }
//**** INVENTORY (TOP GROUP) //**** INVENTORY (TOP GROUP)
if (sub.length > 0) { if (sub.length > 0 && !isSu) {
addNavItem("Inventory", "$ayiDolly", undefined, sub, key++, "inventory"); addNavItem("Inventory", "$ayiDolly", undefined, sub, key++, "inventory");
} }
//######### VENDORS (TOP GROUP) //######### 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"); addNavItem("VendorList", "$ayiStore", "/vendors", [], key++, "vendor");
} }
@@ -584,7 +589,7 @@ function initNavPanel() {
} }
// ** ACCOUNTING (TOP) // ** ACCOUNTING (TOP)
if (sub.length > 0) { if (sub.length > 0 && !isSu) {
addNavItem( addNavItem(
"Accounting", "Accounting",
"$ayiCoins", "$ayiCoins",

View File

@@ -88,6 +88,9 @@ export default new Vuex.Store({
return false; return false;
} }
return false; return false;
},
isSuperUser: state => {
return state.userId === 1;
} }
}, },
mutations: { mutations: {

View File

@@ -373,12 +373,19 @@ export default {
try { try {
let res = await window.$gz.api.get("notify/hello"); let res = await window.$gz.api.get("notify/hello");
if (res.data != null) { if (res.data != null) {
if (res.data.sudf == true) { //if the superuser exists with default credentials then use it to get them going unless the trial eval users exist in which case use bizadmin as the default
//as it has more rights to view things
if (res.data.eval == true) {
vm.input.username = "BizAdmin";
vm.input.password = "BizAdmin";
vm.reveal = true; //might as well show it since it's the default anyway
} else if (res.data.sudf == true) {
//superuser is default creds //superuser is default creds
vm.input.username = "superuser"; vm.input.username = "superuser";
vm.input.password = "l3tm3in"; vm.input.password = "l3tm3in";
vm.reveal = true; //might as well show it since it's the default anyway vm.reveal = true; //might as well show it since it's the default anyway
} }
//However, if the eval users exist then
vm.showEvalUsers = res.data.eval; vm.showEvalUsers = res.data.eval;
vm.hasSmallLogo = res.data.sl; vm.hasSmallLogo = res.data.sl;
vm.hasMediumLogo = res.data.ml; vm.hasMediumLogo = res.data.ml;