User reportTo = null;
if (reportToID != null) {
reportTo = baseService.getEntityById(User.class, reportToID);
}
user.setReport_to(reportTo);
Md5PasswordEncoder encoder = new Md5PasswordEncoder();
if (user.getId() != null) {
UserUtil.permissionCheck("update_system");
User originalUser = baseService.getEntityById(User.class,
user.getId());
String oldPassword = originalUser.getPassword();
if (!oldPassword.equalsIgnoreCase(user.getPassword())) {
user.setPassword(encoder.encodePassword(user.getPassword(),
AuthenticationFilter.SALT));
}
user.setRoles(originalUser.getRoles());
user.setTargetLists(originalUser.getTargetLists());
user.setCalls(originalUser.getCalls());
user.setMeetings(originalUser.getMeetings());
user.setCreated_on(originalUser.getCreated_on());
user.setCreated_by(originalUser.getCreated_by());
} else {
UserUtil.permissionCheck("create_system");
user.setPassword(encoder.encodePassword(user.getPassword(),
AuthenticationFilter.SALT));
}
super.updateBaseInfo(user);
}