Adding deviceStatisticsEnabled property to check visibility of device-statistics menu item

revert-dabc3590
dilanua 8 years ago
parent edd400bde4
commit dbeedf246b

@ -7,7 +7,6 @@
"httpsWebURL" : "%https.ip%", "httpsWebURL" : "%https.ip%",
"wssURL" : "%https.ip%", "wssURL" : "%https.ip%",
"wsURL" : "%http.ip%", "wsURL" : "%http.ip%",
"dashboardServerURL" : "%https.ip%",
"enrollmentDir": "/emm-web-agent/enrollment", "enrollmentDir": "/emm-web-agent/enrollment",
"iOSConfigRoot" : "%https.ip%/ios-enrollment/", "iOSConfigRoot" : "%https.ip%/ios-enrollment/",
"iOSAPIRoot" : "%https.ip%/ios/", "iOSAPIRoot" : "%https.ip%/ios/",
@ -121,5 +120,6 @@
"isOAuthEnabled" : true, "isOAuthEnabled" : true,
"backendRestEndpoints" : { "backendRestEndpoints" : {
"deviceMgt" : "/api/device-mgt/v1.0" "deviceMgt" : "/api/device-mgt/v1.0"
} },
"deviceStatisticsEnabled" : false
} }

@ -28,10 +28,12 @@
System Resources System Resources
</a> </a>
</li> </li>
{{#if permissions.VIEW_DASHBOARD}} {{#if dashboardAvailable}}
<li><a href="{{serverURL}}/portal/t/{{currentUser.domain}}/dashboards/emm-analytics-dashboard/"> {{#if permissions.VIEW_DASHBOARD}}
<i class="fw fw-bar-chart"></i>Device Statistics</a> <li><a href="{{serverURL}}/portal/t/{{currentUser.domain}}/dashboards/emm-analytics-dashboard/">
</li> <i class="fw fw-bar-chart"></i>Device Statistics</a>
</li>
{{/if}}
{{/if}} {{/if}}
{{#if permissions.LIST_DEVICES}} {{#if permissions.LIST_DEVICES}}
<li> <li>
@ -104,6 +106,7 @@
<ul class="sidebar-messages"></ul> <ul class="sidebar-messages"></ul>
<br> <br>
<div class="text-center"> <div class="text-center">
<!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/notification-listing" class="btn-operations btn-default"> <a href="{{@app.context}}/notification-listing" class="btn-operations btn-default">
<span class="fw-stack"> <span class="fw-stack">
<i class="fw fw-ring fw-stroke fw-stack-2x"></i> <i class="fw fw-ring fw-stroke fw-stack-2x"></i>

@ -17,6 +17,10 @@
*/ */
function onRequest(context) { function onRequest(context) {
var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var mdmProps = require("/app/modules/conf-reader/main.js")["conf"];
var constants = require("/app/modules/constants.js");
context.handlebars.registerHelper('equal', function (lvalue, rvalue, options) { context.handlebars.registerHelper('equal', function (lvalue, rvalue, options) {
if (arguments.length < 3) { if (arguments.length < 3) {
throw new Error("Handlebars Helper equal needs 2 parameters"); throw new Error("Handlebars Helper equal needs 2 parameters");
@ -27,9 +31,7 @@ function onRequest(context) {
return options.fn(this); return options.fn(this);
} }
}); });
var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var mdmProps = require("/app/modules/conf-reader/main.js")["conf"];
var constants = require("/app/modules/constants.js");
var links = { var links = {
"user-mgt": [], "user-mgt": [],
"role-mgt": [], "role-mgt": [],
@ -40,7 +42,7 @@ function onRequest(context) {
// following viewModel.link value comes here based on the value passed at the point // following viewModel.link value comes here based on the value passed at the point
// where units are attached to a page zone. // where units are attached to a page zone.
// eg: {{unit "appbar" pageLink="users" title="User Management"}} // eg: {{unit "app-bar" pageLink="users" title="User Management"}}
viewModel["currentActions"] = links[viewModel["pageLink"]]; viewModel["currentActions"] = links[viewModel["pageLink"]];
viewModel["enrollmentURL"] = mdmProps["generalConfig"]["host"] + mdmProps["enrollmentDir"]; viewModel["enrollmentURL"] = mdmProps["generalConfig"]["host"] + mdmProps["enrollmentDir"];
viewModel["currentUser"] = session.get(constants["USER_SESSION_KEY"]); viewModel["currentUser"] = session.get(constants["USER_SESSION_KEY"]);
@ -57,6 +59,8 @@ function onRequest(context) {
permissions["LIST_NOTIFICATIONS"] = userModule.isAuthorized("/permission/admin/device-mgt/notifications/view"); permissions["LIST_NOTIFICATIONS"] = userModule.isAuthorized("/permission/admin/device-mgt/notifications/view");
permissions["VIEW_DASHBOARD"] = userModule.isAuthorized("/permission/admin/device-mgt/dashboard/view"); permissions["VIEW_DASHBOARD"] = userModule.isAuthorized("/permission/admin/device-mgt/dashboard/view");
viewModel["dashboardAvailable"] = mdmProps["deviceStatisticsEnabled"];
viewModel["permissions"] = permissions; viewModel["permissions"] = permissions;
viewModel["appContext"] = mdmProps["appContext"]; viewModel["appContext"] = mdmProps["appContext"];
viewModel["serverURL"] = mdmProps["httpsWebURL"]; viewModel["serverURL"] = mdmProps["httpsWebURL"];

Loading…
Cancel
Save