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 b3b8ff7e8ef..bc5c727bcb5 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 @@ -42,7 +42,7 @@ var userModule = function () { privateMethods.getCarbonUser = function () { var carbon = require("carbon"); var carbonUser = session.get(constants["USER_SESSION_KEY"]); - var utility = require("/modules/utility.js")["utility"]; + var utility = require("/app/modules/utility.js")["utility"]; if (!carbonUser) { log.error("User object was not found in the session"); throw constants["ERRORS"]["USER_NOT_FOUND"]; @@ -174,7 +174,11 @@ var userModule = function () { utility.startTenantFlow(carbonUser); var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/users/" + encodeURIComponent(username) + "/roles"; - return privateMethods.callBackend(url, constants["HTTP_GET"]); + var response = privateMethods.callBackend(url, constants["HTTP_GET"]); + if (response.status == "success") { + response.content = parse(response.content).roles; + } + return response; } catch (e) { throw e; } finally { @@ -265,7 +269,7 @@ var userModule = function () { /** * Get Platforms. */ - //TODO Move this piece of logic out of user.js to somewhere else appropriate. + //TODO Move this piece of logic out of user.js to somewhere else appropriate. publicMethods.getPlatforms = function () { var carbonUser = session.get(constants["USER_SESSION_KEY"]); var utility = require("/app/modules/utility.js")["utility"]; 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 9fc20f80494..8716965fd20 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 @@ -56,9 +56,9 @@