From 9a0ba9137bcee1449c578384d6f054ac56815dad Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Mon, 23 Jan 2017 16:24:20 +0530 Subject: [PATCH] Fixed permissions issue on grouping --- .../devicemgt/app/modules/business-controllers/group.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 de20da586d..a7727ccea5 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 @@ -39,7 +39,11 @@ var groupModule = {}; } else if (permissions.LIST_GROUPS) { endPoint = deviceServiceEndpoint + "/groups/count"; } else { - log.error("Access denied for user: " + carbonUser.username); + if (!user) { + log.error("User object was not found in the session"); + throw constants["ERRORS"]["USER_NOT_FOUND"]; + } + log.error("Access denied for user: " + user.username); return -1; } return serviceInvokers.XMLHttp.get( @@ -116,7 +120,7 @@ var groupModule = {}; } ); }; - + groupModule.getRolesOfGroup = function (groupId) { return serviceInvokers.XMLHttp.get( deviceServiceEndpoint + "/groups/id/" + groupId + "/roles", function (responsePayload) {