diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js index 4510106bad..c12327a912 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js @@ -22,7 +22,7 @@ deviceModule = function () { var utility = require('/app/modules/utility.js').utility; var constants = require('/app/modules/constants.js'); - var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; + var mdmProps = require("/app/modules/conf-reader/main.js")["conf"]; var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"]; // var ArrayList = Packages.java.util.ArrayList; @@ -33,6 +33,8 @@ deviceModule = function () { // var ConfigOperation = Packages.org.wso2.carbon.device.mgt.core.operation.mgt.ConfigOperation; // var CommandOperation = Packages.org.wso2.carbon.device.mgt.core.operation.mgt.CommandOperation; + var deviceManagementService = utility.getDeviceManagementService(); + var publicMethods = {}; var privateMethods = {}; @@ -215,18 +217,20 @@ deviceModule = function () { var utility = require('/app/modules/utility.js')["utility"]; try { utility.startTenantFlow(carbonUser); - - var url = devicemgtProps["httpsURL"] + constants.ADMIN_SERVICE_CONTEXT + "/devices/view?type=" + deviceType + "&id=" + deviceId; + //var url = mdmProps["httpsURL"] + "/mdm-admin/devices/view?type=" + deviceType + "&id=" + deviceId; + var url = mdmProps["httpsURL"] + "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceId; return serviceInvokers.XMLHttp.get( - url, function (responsePayload) { - var device = responsePayload.responseContent; - if (device) { + url, + function (backendResponse) { + var response = {}; + if (backendResponse.status == 200 && backendResponse.responseText) { + response["status"] = "success"; + var device = parse(backendResponse.responseText); var propertiesList = device["properties"]; var properties = {}; - if (propertiesList){ - for (var i = 0; i < propertiesList.length; i++) { - properties[propertiesList[i]["name"]] = propertiesList[i]["value"]; - } + for (var i = 0; i < propertiesList.length; i++) { + properties[propertiesList[i]["name"]] = + propertiesList[i]["value"]; } var deviceObject = {}; deviceObject[constants["DEVICE_IDENTIFIER"]] = device["deviceIdentifier"]; @@ -241,13 +245,12 @@ deviceModule = function () { properties[constants["DEVICE_VENDOR"]] = constants["VENDOR_APPLE"]; } deviceObject[constants["DEVICE_PROPERTIES"]] = properties; - return deviceObject; + response["content"] = deviceObject; + return response; + } else { + response["status"] = "error"; + return response; } - }, - function (responsePayload) { - var response = {}; - response["status"] = "error"; - return response; } ); } catch (e) { @@ -310,9 +313,9 @@ deviceModule = function () { var url; var license; if (deviceType == "windows") { - url = devicemgtProps["httpURL"] + "/mdm-windows-agent/services/device/license"; + url = mdmProps["httpURL"] + "/mdm-windows-agent/services/device/license"; } else if (deviceType == "ios") { - url = devicemgtProps["httpsURL"] + "/ios-enrollment/license/"; + url = mdmProps["httpsURL"] + "/ios-enrollment/license/"; } if (url != null && url != undefined) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/user.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/user.js index 8e885cd00b..b3b8ff7e8e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/user.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/user.js @@ -239,8 +239,7 @@ var userModule = function () { * Get User Roles from user store (Internal roles not included). * @returns {object} a response object with status and content on success. */ - publicMethods.getRolesByUserStore = function () { - var ROLE_LIMIT = devicemgtProps["pageSize"]; + publicMethods.getRolesByUserStore = function (userStore) { var carbonUser = session.get(constants["USER_SESSION_KEY"]); var utility = require("/app/modules/utility.js")["utility"]; if (!carbonUser) { @@ -249,7 +248,8 @@ var userModule = function () { } try { utility.startTenantFlow(carbonUser); - var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/roles?limit=" + ROLE_LIMIT; + var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + + "/roles?user-store=" + userStore + "&limit=100"; var response = privateMethods.callBackend(url, constants["HTTP_GET"]); if (response.status == "success") { response.content = parse(response.content).roles; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/create.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/create.hbs index d9f24cd04f..9fc20f8049 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/create.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/create.hbs @@ -67,25 +67,19 @@
User was added successfully.