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 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",

View File

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

View File

@@ -373,12 +373,19 @@ export default {
try {
let res = await window.$gz.api.get("notify/hello");
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
vm.input.username = "superuser";
vm.input.password = "l3tm3in";
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.hasSmallLogo = res.data.sl;
vm.hasMediumLogo = res.data.ml;