From d4283a39e881670be75b22ad4548ad4584dcb099 Mon Sep 17 00:00:00 2001 From: Rasika Date: Fri, 29 May 2015 22:58:42 +0530 Subject: [PATCH] fixing jars --- .../jaggeryapps/iot/modules/user.js | 60 +++++++++---------- .../jaggeryapps/iot/modules/utility.js | 18 +++--- 2 files changed, 40 insertions(+), 38 deletions(-) diff --git a/modules/distribution/src/repository/jaggeryapps/iot/modules/user.js b/modules/distribution/src/repository/jaggeryapps/iot/modules/user.js index a392d7b1..2dfff33e 100644 --- a/modules/distribution/src/repository/jaggeryapps/iot/modules/user.js +++ b/modules/distribution/src/repository/jaggeryapps/iot/modules/user.js @@ -23,7 +23,7 @@ userModule = function () { var constants = require("/modules/constants.js"); var utility = require("/modules/utility.js").utility; - var userManagementService = utility.getUserManagementService(); + //var userManagementService = utility.getUserManagementService(); var publicMethods = {}; var privateMethods = {}; @@ -245,35 +245,35 @@ userModule = function () { } }; - publicMethods.getUsers = function () { - var carbon = require('carbon'); - - var carbonUser = session.get(constants.USER_SESSION_KEY); - if (!carbonUser) { - log.error("User object was not found in the session"); - throw constants.ERRORS.USER_NOT_FOUND; - } - - var userList; - try{ - userList = userManagementService.getUsersForTenant(carbonUser.tenantId); - }catch(e){ - log.error("Error occurred while reading all users"); - return []; - } - - var users = []; - var i, userObject; - for (i = 0; i < userList.size(); i++) { - userObject = userList.get(i); - users.push({ - "username" : userObject.getUserName(), - "email" : userObject.getEmail(), - "name" : userObject.getFirstName() + " " + userObject.getLastName() - }); - } - return users; - }; + //publicMethods.getUsers = function () { + // var carbon = require('carbon'); + // + // var carbonUser = session.get(constants.USER_SESSION_KEY); + // if (!carbonUser) { + // log.error("User object was not found in the session"); + // throw constants.ERRORS.USER_NOT_FOUND; + // } + // + // var userList; + // try{ + // userList = userManagementService.getUsersForTenant(carbonUser.tenantId); + // }catch(e){ + // log.error("Error occurred while reading all users"); + // return []; + // } + // + // var users = []; + // var i, userObject; + // for (i = 0; i < userList.size(); i++) { + // userObject = userList.get(i); + // users.push({ + // "username" : userObject.getUserName(), + // "email" : userObject.getEmail(), + // "name" : userObject.getFirstName() + " " + userObject.getLastName() + // }); + // } + // return users; + //}; publicMethods.isAuthorized = function (permission) { var carbonModule = require("carbon"); diff --git a/modules/distribution/src/repository/jaggeryapps/iot/modules/utility.js b/modules/distribution/src/repository/jaggeryapps/iot/modules/utility.js index c1319a40..6286701b 100644 --- a/modules/distribution/src/repository/jaggeryapps/iot/modules/utility.js +++ b/modules/distribution/src/repository/jaggeryapps/iot/modules/utility.js @@ -18,18 +18,20 @@ var utility; utility = function () { - var JavaClass = Packages.java.lang.Class; - var PrivilegedCarbonContext = Packages.org.wso2.carbon.context.PrivilegedCarbonContext; + //var JavaClass = Packages.java.lang.Class; + //var PrivilegedCarbonContext = Packages.org.wso2.carbon.context.PrivilegedCarbonContext; - var getOsgiService = function (className) { - return PrivilegedCarbonContext.getThreadLocalCarbonContext().getOSGiService(JavaClass.forName(className)); - }; + //var getOsgiService = function (className) { + // var log = new Log(); + // log.info("###### Current Class : "+className); + // return PrivilegedCarbonContext.getThreadLocalCarbonContext().getOSGiService(JavaClass.forName(className)); + //}; var publicMethods = {}; - publicMethods.getUserManagementService = function () { - return getOsgiService('org.wso2.carbon.device.mgt.user.core.service.UserManagementService'); - }; + //publicMethods.getUserManagementService = function () { + // return getOsgiService('org.wso2.carbon.device.mgt.user.core.service.UserManagementService'); + //}; publicMethods.insertAppPermissions = function (userModule, type) { userModule.addPermissions([{key: "device-mgt", name: "Device Management"}], "", type);