diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/group.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/group.js index a7727ccea5..82ecb1ae3d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/group.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/group.js @@ -48,7 +48,7 @@ var groupModule = {}; } return serviceInvokers.XMLHttp.get( endPoint, function (responsePayload) { - return responsePayload["responseText"]; + return parse(responsePayload["responseText"]); }, function (responsePayload) { log.error(responsePayload["responseText"]); 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 c6ed7da1bd..8de168ccea 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 @@ -463,7 +463,13 @@ var userModule = function () { publicMethods.isAuthorized = function (permission) { var carbon = require("carbon"); var carbonServer = application.get("carbonServer"); - var carbonUser = session.get(constants.USER_SESSION_KEY); + var carbonUser; + try { + carbonUser = session.get(constants.USER_SESSION_KEY); + } catch (e) { + log.error("User object was not found in the session"); + carbonUser = null; + } var utility = require('/app/modules/utility.js').utility; if (!carbonUser) { log.error("User object was not found in the session"); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/token-handlers.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/token-handlers.js index 771db411f2..22da928495 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/token-handlers.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/oauth/token-handlers.js @@ -40,7 +40,7 @@ var handlers = function () { "as input - setupTokenPairByPasswordGrantType(x, y)"); } else { privateMethods.setUpEncodedTenantBasedClientAppCredentials(username); - privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username); + //privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username); var encodedClientAppCredentials = session.get(constants["ENCODED_TENANT_BASED_CLIENT_APP_CREDENTIALS"]); if (!encodedClientAppCredentials) { throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up access token pair by " + @@ -84,7 +84,7 @@ var handlers = function () { "as input - setupTokenPairBySamlGrantType(x, y)"); } else { privateMethods.setUpEncodedTenantBasedClientAppCredentials(username); - privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username); + //privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username); var encodedClientAppCredentials = session.get(constants["ENCODED_TENANT_BASED_CLIENT_APP_CREDENTIALS"]); if (!encodedClientAppCredentials) { throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up access token pair " + @@ -129,7 +129,7 @@ var handlers = function () { "as input - setupTokenPairBySamlGrantType(x, y)"); } else { privateMethods.setUpEncodedTenantBasedClientAppCredentials(username); - privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username); + //privateMethods.setUpEncodedTenantBasedWebSocketClientAppCredentials(username); var encodedClientAppCredentials = session.get(constants["ENCODED_TENANT_BASED_CLIENT_APP_CREDENTIALS"]); if (!encodedClientAppCredentials) { throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up access token pair " + @@ -224,44 +224,44 @@ var handlers = function () { } }; - privateMethods["setUpEncodedTenantBasedWebSocketClientAppCredentials"] = function (username) { - if (!username) { - throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant based " + - "client credentials to session context. No username of logged in user is found as " + - "input - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)"); - } else { - if (devicemgtProps["gatewayEnabled"]) { - var tenantBasedWebSocketClientAppCredentials - = tokenUtil.getTenantBasedWebSocketClientAppCredentials(username); - if (!tenantBasedWebSocketClientAppCredentials) { - throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant " + - "based client credentials to session context as the server is unable " + - "to obtain such credentials - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)"); - } else { - var encodedTenantBasedWebSocketClientAppCredentials = - tokenUtil.encode(tenantBasedWebSocketClientAppCredentials["clientId"] + ":" + - tenantBasedWebSocketClientAppCredentials["clientSecret"]); - // setting up encoded tenant based client credentials to session context. - session.put(constants["ENCODED_TENANT_BASED_WEB_SOCKET_CLIENT_CREDENTIALS"], - encodedTenantBasedWebSocketClientAppCredentials); - } - } else { - var dynamicClientAppCredentials = tokenUtil.getDynamicClientAppCredentials(); - if (!dynamicClientAppCredentials) { - throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant based " + - "client credentials to session context as the server is unable to obtain " + - "dynamic client credentials - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)"); - } - var encodedTenantBasedWebSocketClientAppCredentials = - tokenUtil.encode(dynamicClientAppCredentials["clientId"] + ":" + - dynamicClientAppCredentials["clientSecret"]); - // setting up encoded tenant based client credentials to session context. - session.put(constants["ENCODED_TENANT_BASED_WEB_SOCKET_CLIENT_CREDENTIALS"], - encodedTenantBasedWebSocketClientAppCredentials); - } +// privateMethods["setUpEncodedTenantBasedWebSocketClientAppCredentials"] = function (username) { +// if (!username) { +// throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant based " + +// "client credentials to session context. No username of logged in user is found as " + +// "input - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)"); +// } else { +// if (devicemgtProps["gatewayEnabled"]) { +// var tenantBasedWebSocketClientAppCredentials +// = tokenUtil.getTenantBasedWebSocketClientAppCredentials(username); +// if (!tenantBasedWebSocketClientAppCredentials) { +// throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant " + +// "based client credentials to session context as the server is unable " + +// "to obtain such credentials - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)"); +// } else { +// var encodedTenantBasedWebSocketClientAppCredentials = +// tokenUtil.encode(tenantBasedWebSocketClientAppCredentials["clientId"] + ":" + +// tenantBasedWebSocketClientAppCredentials["clientSecret"]); +// // setting up encoded tenant based client credentials to session context. +// session.put(constants["ENCODED_TENANT_BASED_WEB_SOCKET_CLIENT_CREDENTIALS"], +// encodedTenantBasedWebSocketClientAppCredentials); +// } +// } else { +// var dynamicClientAppCredentials = tokenUtil.getDynamicClientAppCredentials(); +// if (!dynamicClientAppCredentials) { +// throw new Error("{/app/modules/oauth/token-handlers.js} Could not set up encoded tenant based " + +// "client credentials to session context as the server is unable to obtain " + +// "dynamic client credentials - setUpEncodedTenantBasedWebSocketClientAppCredentials(x)"); +// } +// var encodedTenantBasedWebSocketClientAppCredentials = +// tokenUtil.encode(dynamicClientAppCredentials["clientId"] + ":" + +// dynamicClientAppCredentials["clientSecret"]); +// // setting up encoded tenant based client credentials to session context. +// session.put(constants["ENCODED_TENANT_BASED_WEB_SOCKET_CLIENT_CREDENTIALS"], +// encodedTenantBasedWebSocketClientAppCredentials); +// } - } - }; +// } +// }; return publicMethods; -}(); \ No newline at end of file +}(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.hbs index 90ec4bf89c..f526cc03a3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.dashboard/dashboard.hbs @@ -78,7 +78,7 @@ {{/if}} - {{#unless isCloud}} + @@ -86,7 +86,7 @@ Add - {{/unless}} + @@ -144,7 +144,7 @@ {{/if}} - {{#unless isCloud}} + @@ -152,7 +152,7 @@ Add - {{/unless}} + @@ -197,4 +197,4 @@ {{/if}} -{{/zone}} \ No newline at end of file +{{/zone}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.hbs index 354c6f2bb7..bdd2e9d39b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/devices.hbs @@ -57,7 +57,7 @@ Assign from My Devices -