This commit is contained in:
@@ -42,11 +42,26 @@ export default {
|
|||||||
///<summary>SalesLimited</summary>
|
///<summary>SalesLimited</summary>
|
||||||
SalesLimited: 65536
|
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) {
|
hasRole(desiredRole) {
|
||||||
if (!window.$gz.store.state.roles || window.$gz.store.state.roles === 0) {
|
if (!window.$gz.store.state.roles || window.$gz.store.state.roles === 0) {
|
||||||
return false;
|
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
|
// Get a default empty rights object so that it can be present when a
|
||||||
|
|||||||
@@ -402,57 +402,64 @@ export default function initialize() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
//****************** OPERATIONS
|
//****************** OPERATIONS
|
||||||
//clear sublevel array
|
if (
|
||||||
sub = [];
|
window.$gz.role.hasRole([
|
||||||
|
window.$gz.role.AUTHORIZATION_ROLES.OpsAdminFull,
|
||||||
|
window.$gz.role.AUTHORIZATION_ROLES.OpsAdminLimited
|
||||||
|
])
|
||||||
|
) {
|
||||||
|
//clear sublevel array
|
||||||
|
sub = [];
|
||||||
|
|
||||||
// ARCHIVE
|
// ARCHIVE
|
||||||
sub.push({
|
sub.push({
|
||||||
title: window.$gz.locale.get("Backup"),
|
title: window.$gz.locale.get("Backup"),
|
||||||
icon: "file-archive",
|
icon: "file-archive",
|
||||||
route: "/ops-backup",
|
route: "/ops-backup",
|
||||||
key: key++
|
key: key++
|
||||||
});
|
});
|
||||||
|
|
||||||
// JOBS
|
// JOBS
|
||||||
sub.push({
|
sub.push({
|
||||||
title: window.$gz.locale.get("ServerJobs"),
|
title: window.$gz.locale.get("ServerJobs"),
|
||||||
icon: "robot",
|
icon: "robot",
|
||||||
route: "/ops-jobs",
|
route: "/ops-jobs",
|
||||||
key: key++
|
key: key++
|
||||||
});
|
});
|
||||||
|
|
||||||
// LOGS
|
// LOGS
|
||||||
sub.push({
|
sub.push({
|
||||||
title: window.$gz.locale.get("ServerLog"),
|
title: window.$gz.locale.get("ServerLog"),
|
||||||
icon: "history",
|
icon: "history",
|
||||||
route: "/ops-log",
|
route: "/ops-log",
|
||||||
key: key++
|
key: key++
|
||||||
});
|
});
|
||||||
|
|
||||||
//METRICS
|
//METRICS
|
||||||
sub.push({
|
sub.push({
|
||||||
title: window.$gz.locale.get("ServerMetrics"),
|
title: window.$gz.locale.get("ServerMetrics"),
|
||||||
icon: "file-medical-alt",
|
icon: "file-medical-alt",
|
||||||
route: "/ops-metrics",
|
route: "/ops-metrics",
|
||||||
key: key++
|
key: key++
|
||||||
});
|
});
|
||||||
|
|
||||||
//NOTIFICATION CONFIG AND HISTORY
|
//NOTIFICATION CONFIG AND HISTORY
|
||||||
sub.push({
|
sub.push({
|
||||||
title: window.$gz.locale.get("NotificationSettings"),
|
title: window.$gz.locale.get("NotificationSettings"),
|
||||||
icon: "bullhorn",
|
icon: "bullhorn",
|
||||||
route: "/ops-notification-settings",
|
route: "/ops-notification-settings",
|
||||||
key: key++
|
key: key++
|
||||||
});
|
});
|
||||||
|
|
||||||
// ** OPERATIONS (TOP)
|
// ** OPERATIONS (TOP)
|
||||||
addNavItem(
|
addNavItem(
|
||||||
window.$gz.locale.get("Operations"),
|
window.$gz.locale.get("Operations"),
|
||||||
"server",
|
"server",
|
||||||
undefined,
|
undefined,
|
||||||
sub,
|
sub,
|
||||||
key++
|
key++
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
//**** WIDGETS (TOP GROUP)
|
//**** WIDGETS (TOP GROUP)
|
||||||
addNavItem(
|
addNavItem(
|
||||||
|
|||||||
Reference in New Issue
Block a user