This commit is contained in:
2020-01-03 19:01:35 +00:00
parent db9d259b4a
commit d08ff54187
2 changed files with 68 additions and 46 deletions

View File

@@ -42,11 +42,26 @@ export default {
///<summary>SalesLimited</summary>
SalesLimited: 65536
},
//////////////////////////////////////////////////////////
// Does current logged in user have role?
// (Can be an array of roles or a single role, if array returns true if any of the array roles are present for this user)
//
hasRole(desiredRole) {
if (!window.$gz.store.state.roles || window.$gz.store.state.roles === 0) {
return false;
}
return (window.$gz.store.state.roles & desiredRole) != 0;
//array form?
if (window.$gz._.isArray(desiredRole)) {
//it's an array of roles, iterate and if any are present then return true
for (var i = 0; i < desiredRole.length; i++) {
if ((window.$gz.store.state.roles & desiredRole[i]) != 0) {
return true;
}
}
return false;
} else {
return (window.$gz.store.state.roles & desiredRole) != 0;
}
},
///////////////////////////////////////////////////////////////////////
// Get a default empty rights object so that it can be present when a

View File

@@ -402,57 +402,64 @@ export default function initialize() {
);
//****************** OPERATIONS
//clear sublevel array
sub = [];
if (
window.$gz.role.hasRole([
window.$gz.role.AUTHORIZATION_ROLES.OpsAdminFull,
window.$gz.role.AUTHORIZATION_ROLES.OpsAdminLimited
])
) {
//clear sublevel array
sub = [];
// ARCHIVE
sub.push({
title: window.$gz.locale.get("Backup"),
icon: "file-archive",
route: "/ops-backup",
key: key++
});
// ARCHIVE
sub.push({
title: window.$gz.locale.get("Backup"),
icon: "file-archive",
route: "/ops-backup",
key: key++
});
// JOBS
sub.push({
title: window.$gz.locale.get("ServerJobs"),
icon: "robot",
route: "/ops-jobs",
key: key++
});
// JOBS
sub.push({
title: window.$gz.locale.get("ServerJobs"),
icon: "robot",
route: "/ops-jobs",
key: key++
});
// LOGS
sub.push({
title: window.$gz.locale.get("ServerLog"),
icon: "history",
route: "/ops-log",
key: key++
});
// LOGS
sub.push({
title: window.$gz.locale.get("ServerLog"),
icon: "history",
route: "/ops-log",
key: key++
});
//METRICS
sub.push({
title: window.$gz.locale.get("ServerMetrics"),
icon: "file-medical-alt",
route: "/ops-metrics",
key: key++
});
//METRICS
sub.push({
title: window.$gz.locale.get("ServerMetrics"),
icon: "file-medical-alt",
route: "/ops-metrics",
key: key++
});
//NOTIFICATION CONFIG AND HISTORY
sub.push({
title: window.$gz.locale.get("NotificationSettings"),
icon: "bullhorn",
route: "/ops-notification-settings",
key: key++
});
//NOTIFICATION CONFIG AND HISTORY
sub.push({
title: window.$gz.locale.get("NotificationSettings"),
icon: "bullhorn",
route: "/ops-notification-settings",
key: key++
});
// ** OPERATIONS (TOP)
addNavItem(
window.$gz.locale.get("Operations"),
"server",
undefined,
sub,
key++
);
// ** OPERATIONS (TOP)
addNavItem(
window.$gz.locale.get("Operations"),
"server",
undefined,
sub,
key++
);
}
//**** WIDGETS (TOP GROUP)
addNavItem(