Long users_id = sessionManagement.checkSession(SID);
Long user_level = userManagement.getUserLevelByID(users_id);
if (authLevelManagement.checkAdminLevel(user_level)) {
Users 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, "", true, // generate SIP Data if
// the config is enabled
jNameTimeZone);
if (user_id < 0) {
return user_id;
}
Users 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;