user.setPhoneNumber(userForm.getPhoneNumber());
user.setSmsAddress(userForm.getSmsAddress());
user.setFactive(userForm.getEnableLogin().equals("yes"));
// a user can only edit his own configuration
WebUser currentUser = RequestUtils.getWebUser(request);
if (currentUser.getId().equals(userForm.getId())) {
// update the in-memory preferences of the webuser so it takes effect for this session
try {
WebUserPreferences webPreferences = currentUser.getWebPreferences();
int pageRefreshPeriod = Integer.valueOf(userForm.getPageRefreshPeriod());
webPreferences.setPageRefreshPeriod(pageRefreshPeriod);
} catch (NumberFormatException e) {
throw new RuntimeException(
"pageRefreshPeriod is not an integer, this should have been caught earlier by the form validation.");
}
try {
SubjectPreferences corePreferences = currentUser.getSubjectPreferences();
int timeoutPeriod = Integer.valueOf(userForm.getGroupConfigurationTimeout());
corePreferences.setGroupConfigurationTimeoutPeriod(timeoutPeriod);
} catch (NumberFormatException e) {
throw new RuntimeException(
"groupConfigurationTimeout is not an integer, this should have been caught earlier by the form validation.");
}
}
subjectManager.updateSubject(currentUser.getSubject(), user);
return returnSuccess(request, mapping, Constants.USER_PARAM, userForm.getId());
}