Merge remote-tracking branch 'upstream/master'

application-manager-new
charithag 9 years ago
commit 2f6e195f95

@ -78,9 +78,9 @@ if (uriMatcher.match("/{context}/api/user/login/")) {
} else { } else {
userRoles = String(addUserFormData.userRoles).split(","); userRoles = String(addUserFormData.userRoles).split(",");
} }
userRoles=["deviceRole, deviceUser"];
//TODO-Apply new users, userRoles="deviceRole,deviceUser".split(",");
userRoles = [];
try { try {
result = userModule.registerUser(username, firstname, lastname, emailAddress, password, result = userModule.registerUser(username, firstname, lastname, emailAddress, password,
userRoles); userRoles);

@ -23,8 +23,6 @@ policyModule = function () {
var constants = require("/modules/constants.js"); var constants = require("/modules/constants.js");
var utility = require("/modules/utility.js").utility; var utility = require("/modules/utility.js").utility;
var userManagementService = utility.getUserManagementService();
var publicMethods = {}; var publicMethods = {};
var privateMethods = {}; var privateMethods = {};

@ -250,16 +250,25 @@ userModule = function () {
log.error("User object was not found in the session"); log.error("User object was not found in the session");
throw constants.ERRORS.USER_NOT_FOUND; throw constants.ERRORS.USER_NOT_FOUND;
} }
var carbon = require('carbon');
var tenantId = carbon.server.tenantId();
var url = carbon.server.address('https') + "/admin/services";
var server = new carbon.server.Server(url);
var userManager = new carbon.user.UserManager(server, tenantId); var userManager = new carbon.user.UserManager(server, tenantId);
var userList = userManager.listUsers(); var userList = userManager.listUsers();
var i, userObject, email, firstname, lastname;
var i, userObject; for (i = 0; i < userList.length; i++) {
for (i = 0; i < userList.size(); i++) { userObject = userManager.getUser(userList[i]);
userObject = userList.get(i); email = userManager.getClaim(userList[i],"http://wso2.org/claims/emailaddress", null);
var userObj = { firstname = userManager.getClaim(userList[i],"http://wso2.org/claims/givenname", null);
"username" : userObject.getUserName(), lastname = userManager.getClaim(userList[i],"http://wso2.org/claims/lastname", null);
"email" : userObject.getEmail(), //log.info(userManager.getClaimsForSet(userList[i], new Array("http://wso2.org/claims/emailaddress",
"name" : userObject.getFirstName() + " " + userObject.getLastName() // "http://wso2.org/claims/givenname",
// "http://wso2.org/claims/lastname"), null));
userObj = {
"username" : userObject.username,
"email" : email,
"name" : firstname + " " + lastname
}; };
if(userObj.username == "admin"){ if(userObj.username == "admin"){
userObj.name = "admin"; userObj.name = "admin";

Loading…
Cancel
Save