Long users_id = sessiondataDao.checkSession(SID);
Long user_level = userManagement.getUserLevelByID(users_id);
if (AuthLevelUtil.checkAdminLevel(user_level)) {
User testUser = userManagement.getUserByExternalIdAndType(
externalUserId, externalUserType);
if (testUser != null) {
throw new Exception("User does already exist!");
}
// This will send no email to the users
Long user_id = userManagement.registerUserNoEmail(username,
userpass, lastname, firstname, email, new Date(),
street, additionalname, fax, zip, states_id, town,
language_id, "", false, true, // generate SIP Data if the config is enabled
jNameTimeZone);
if (user_id == null || user_id < 0) {
return user_id;
}
User user = userManagement.getUserById(user_id);
// activate the User
user.setStatus(1);
user.setUpdatetime(new Date());
user.setExternalUserId(externalUserId);
user.setExternalUserType(externalUserType);
userManagement.updateUser(user);
return user_id;