|
|
@ -23,7 +23,7 @@ userModule = 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 userManagementService = utility.getUserManagementService();
|
|
|
|
|
|
|
|
|
|
|
|
var publicMethods = {};
|
|
|
|
var publicMethods = {};
|
|
|
|
var privateMethods = {};
|
|
|
|
var privateMethods = {};
|
|
|
@ -245,35 +245,35 @@ userModule = function () {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
publicMethods.getUsers = function () {
|
|
|
|
//publicMethods.getUsers = function () {
|
|
|
|
var carbon = require('carbon');
|
|
|
|
// var carbon = require('carbon');
|
|
|
|
|
|
|
|
//
|
|
|
|
var carbonUser = session.get(constants.USER_SESSION_KEY);
|
|
|
|
// var carbonUser = session.get(constants.USER_SESSION_KEY);
|
|
|
|
if (!carbonUser) {
|
|
|
|
// if (!carbonUser) {
|
|
|
|
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 userList;
|
|
|
|
// var userList;
|
|
|
|
try{
|
|
|
|
// try{
|
|
|
|
userList = userManagementService.getUsersForTenant(carbonUser.tenantId);
|
|
|
|
// userList = userManagementService.getUsersForTenant(carbonUser.tenantId);
|
|
|
|
}catch(e){
|
|
|
|
// }catch(e){
|
|
|
|
log.error("Error occurred while reading all users");
|
|
|
|
// log.error("Error occurred while reading all users");
|
|
|
|
return [];
|
|
|
|
// return [];
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
var users = [];
|
|
|
|
// var users = [];
|
|
|
|
var i, userObject;
|
|
|
|
// var i, userObject;
|
|
|
|
for (i = 0; i < userList.size(); i++) {
|
|
|
|
// for (i = 0; i < userList.size(); i++) {
|
|
|
|
userObject = userList.get(i);
|
|
|
|
// userObject = userList.get(i);
|
|
|
|
users.push({
|
|
|
|
// users.push({
|
|
|
|
"username" : userObject.getUserName(),
|
|
|
|
// "username" : userObject.getUserName(),
|
|
|
|
"email" : userObject.getEmail(),
|
|
|
|
// "email" : userObject.getEmail(),
|
|
|
|
"name" : userObject.getFirstName() + " " + userObject.getLastName()
|
|
|
|
// "name" : userObject.getFirstName() + " " + userObject.getLastName()
|
|
|
|
});
|
|
|
|
// });
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
return users;
|
|
|
|
// return users;
|
|
|
|
};
|
|
|
|
//};
|
|
|
|
|
|
|
|
|
|
|
|
publicMethods.isAuthorized = function (permission) {
|
|
|
|
publicMethods.isAuthorized = function (permission) {
|
|
|
|
var carbonModule = require("carbon");
|
|
|
|
var carbonModule = require("carbon");
|
|
|
|