/**
* 保存用户信息
*/
protected String saveAndForward(Entity<?> entity) {
User user = (User) entity;
if (entityDao.duplicate(User.class, user.getId(), "name", user.getName())) {
addFlashMessageNow("security.error.usernameNotAvaliable", user.getName());
return forward(new Action(this, "edit"));
}
String errorMsg = "";
// 检验用户合法性
errorMsg = checkUser(user);
if (StringUtils.isNotEmpty(errorMsg)) { return forward(new Action("edit"), errorMsg); }
processPassword(user);
if (!user.isPersisted()) {
User creator = userService.get(getUserId());
userService.createUser(creator, user);
} else {
userService.saveOrUpdate(user);
}
updateUserGroup(user);