@RequestMapping(value = "/my", method = RequestMethod.PUT) public String upmy(User user, String repass, Model model) { MapContainer form = UserFormValidator.validateMy(user, repass); if (!form.isEmpty()) { model.addAllAttributes(form); model.addAttribute("my", user); return "backend/user/my"; } user.setRole(WebContextFactory.get().getUser().getRole()); user.setLastUpdate(new Date()); userService.update(user); return "redirect:/backend/users"; }
@RequestMapping(method = RequestMethod.POST) @RequiresRoles("admin") public String insert(User user, String repass, Model model) { MapContainer form = UserFormValidator.validateInsert(user, repass); if (!form.isEmpty()) { model.addAllAttributes(form); return "backend/user/edit"; } user.setId(IdGenerator.uuid19()); user.setCreateTime(new Date()); user.setLastUpdate(user.getCreateTime()); userService.insert(user); return "redirect:/backend/users"; }
@RequestMapping(method = RequestMethod.PUT) public String update(User user, String repass, Model model) { MapContainer form = UserFormValidator.validateUpdate(user, repass); if (!form.isEmpty()) { model.addAllAttributes(form); model.addAttribute("user", user); return "backend/user/edit"; } user.setLastUpdate(new Date()); userService.update(user); return "redirect:/backend/users"; }