* @param form
* @return
*/
private User buildUser(ActionForm form){
UserForm userForm = (UserForm)form;
User user = UserManager.getInstance().getUser(userForm.getUsername());
assert user != null;
List<Role> roles = new ArrayList<Role>(1);
String[] rolesString = userForm.getRole();
for(int ctr=0; ctr < rolesString.length; ctr++){
roles.add(new Role(rolesString[ctr]));
}
user.setRoles(roles);
if(!userForm.getPassword().equals(UserForm.FORM_PASSWORD)){
String hashedPassword = Crypto.hash(userForm.getPassword());
user.setPassword(hashedPassword);
}
user.setStatus(userForm.getStatus());
return user;
}