From f64ff853d0f27ff31696a1d931f5c0e3bf0e4155 Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Sun, 26 Jul 2015 04:13:40 +0530 Subject: [PATCH] improve user listing method --- .../jaggeryapps/iotserver/modules/user.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/modules/distribution/src/repository/jaggeryapps/iotserver/modules/user.js b/modules/distribution/src/repository/jaggeryapps/iotserver/modules/user.js index e294a1e1..76894943 100644 --- a/modules/distribution/src/repository/jaggeryapps/iotserver/modules/user.js +++ b/modules/distribution/src/repository/jaggeryapps/iotserver/modules/user.js @@ -256,15 +256,14 @@ userModule = function () { var server = new carbon.server.Server(url); var userManager = new carbon.user.UserManager(server, tenantId); var userList = userManager.listUsers(); - var i, userObject, email, firstname, lastname; + var i, username, userObject, email, firstname, lastname; for (i = 0; i < userList.length; i++) { - userObject = userManager.getUser(userList[i]); - email = userManager.getClaim(userList[i],"http://wso2.org/claims/emailaddress", null); - firstname = userManager.getClaim(userList[i],"http://wso2.org/claims/givenname", null); - lastname = userManager.getClaim(userList[i],"http://wso2.org/claims/lastname", null); - //log.info(userManager.getClaimsForSet(userList[i], new Array("http://wso2.org/claims/emailaddress", - // "http://wso2.org/claims/givenname", - // "http://wso2.org/claims/lastname"), null)); + username = userList[i]; + userObject = userManager.getUser(username); + email = userManager.getClaim(username,"http://wso2.org/claims/emailaddress", null); + firstname = userManager.getClaim(username,"http://wso2.org/claims/givenname", null); + lastname = userManager.getClaim(username,"http://wso2.org/claims/lastname", null); + //log.info(userManager.getClaimsForSet(username, "http://wso2.org/claims/emailaddress,http://wso2.org/claims/givenname,http://wso2.org/claims/lastname".split(","), null)); userObj = { "username" : userObject.username, "email" : email,