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,28 +212,30 @@ function initNavPanel() {
//####### HOME GROUP //####### HOME GROUP
if (!licenseLockout) { if (!licenseLockout) {
//DASHBOARD //DASHBOARD
sub.push({ if (!isSu) {
title: "Dashboard", sub.push({
icon: "$ayiTachometer", title: "Dashboard",
route: "/home-dashboard", icon: "$ayiTachometer",
key: key++ route: "/home-dashboard",
}); key: key++
});
//SEARCH //SEARCH
sub.push({ sub.push({
title: "Search", title: "Search",
icon: "$ayiSearch", icon: "$ayiSearch",
route: "/home-search", route: "/home-search",
key: key++ key: key++
}); });
//SCHEDULE (personal) //SCHEDULE (personal)
sub.push({ sub.push({
title: "Schedule", title: "Schedule",
icon: "$ayiCalendarDay", icon: "$ayiCalendarDay",
route: "/home-schedule", route: "/home-schedule",
key: key++ key: key++
}); });
}
//MEMOS //MEMOS
sub.push({ sub.push({
@@ -242,22 +245,23 @@ function initNavPanel() {
key: key++ key: key++
}); });
//REMINDERS if (!isSu) {
sub.push({ //REMINDERS
title: "ReminderList", sub.push({
icon: "$ayiStickyNote", title: "ReminderList",
route: "/home-reminders", icon: "$ayiStickyNote",
key: key++ route: "/home-reminders",
}); key: key++
});
//REVIEWS
sub.push({
title: "ReviewList",
icon: "$ayiCalendarCheck",
route: "/home-reviews",
key: key++
});
//REVIEWS
sub.push({
title: "ReviewList",
icon: "$ayiCalendarCheck",
route: "/home-reviews",
key: key++
});
}
//USER SETTINGS //USER SETTINGS
sub.push({ sub.push({
title: "UserSettings", title: "UserSettings",
@@ -265,15 +269,15 @@ 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",
icon: "$ayiBullhorn", icon: "$ayiBullhorn",
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

@@ -129,7 +129,7 @@
@click:append-outer="reveal = !reveal" @click:append-outer="reveal = !reveal"
></v-text-field> ></v-text-field>
</v-col> </v-col>
<v-col cols="12" sm="6" lg="4" xl="3"> <v-col cols="12" sm="6" lg="4" xl="3">
<gz-date-time-picker <gz-date-time-picker
ref="lastLogin" ref="lastLogin"

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;