@PreAuthorize("hasRole('ROLE_SUPERUSER')")
 @RequestMapping(method = RequestMethod.PUT)
 public String update(
     @Valid UserAccount userAccount,
     BindingResult result,
     Model model,
     HttpServletRequest request) {
   if (result.hasErrors()) {
     model.addAttribute("userAccount", userAccount);
     return "useraccounts/update";
   }
   userAccount.merge();
   return "redirect:/useraccounts/"
       + encodeUrlPathSegment(userAccount.getId().toString(), request);
 }
 @PreAuthorize("hasRole('ROLE_SUPERUSER')")
 @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
 public String delete(
     @PathVariable("id") Long id,
     @RequestParam(value = "page", required = false) Integer page,
     @RequestParam(value = "size", required = false) Integer size,
     Model model) {
   UserAccount.findUserAccount(id).remove();
   model.addAttribute("page", (page == null) ? "1" : page.toString());
   model.addAttribute("size", (size == null) ? "10" : size.toString());
   return "redirect:/useraccounts?page="
       + ((page == null) ? "1" : page.toString())
       + "&size="
       + ((size == null) ? "10" : size.toString());
 }
Example #3
0
 public boolean isEnabled() {
   return ua.getEnabled();
 }
Example #4
0
 public String getUsername() {
   return ua.getUserId().toString();
 }
Example #5
0
 public String getPassword() {
   return ua.getPassword();
 }
Example #6
0
 public Collection<GrantedAuthority> getAuthorities() {
   return ua.getUserGroup().getGranted();
 }
 @PreAuthorize("hasRole('ROLE_SUPERUSER')")
 @RequestMapping(value = "/{id}", params = "form", method = RequestMethod.GET)
 public String updateForm(@PathVariable("id") Long id, Model model) {
   model.addAttribute("userAccount", UserAccount.findUserAccount(id));
   return "useraccounts/update";
 }