Fixing invalid device count and group count

revert-70aa11f8
Rasika Perera 8 years ago
parent d7c7315f16
commit 0fab418187

@ -298,20 +298,20 @@ deviceModule = function () {
var url;
if (uiPermissions.LIST_DEVICES) {
url = devicemgtProps["httpsURL"] +
devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/devices/count";
devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/devices?offset=0&limit=1";
} else if (uiPermissions.LIST_OWN_DEVICES) {
url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] +
"/devices/user/" + carbonUser.username + "/count";
"/devices?offset=0&limit=1&user=" + carbonUser.username;
} else {
log.error("Access denied for user: " + carbonUser.username);
return -1;
}
return serviceInvokers.XMLHttp.get(
url, function (responsePayload) {
return responsePayload;
return parse(responsePayload["responseText"])["count"];
},
function (responsePayload) {
log.error(responsePayload);
log.error(responsePayload["responseText"]);
return -1;
}
);

@ -36,7 +36,9 @@ function onRequest() {
page.permissions = permissions;
page.enrollmentURL = devicemgtProps.enrollmentURL;
page.device_count = deviceModule.getDevicesCount();
page.group_count = groupModule.getGroupCount();
//TODO: Enable Group Management Service API on CDMF
//page.group_count = groupModule.getGroupCount();
page.group_count = -1;
page.user_count = userModule.getUsers()["content"].length;
page.policy_count = policyModule.getAllPolicies()["content"].length;
page.role_count = userModule.getRoles()["content"].length;

Loading…
Cancel
Save