Ejemplo n.º 1
0
 @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);
 }
Ejemplo n.º 2
0
 @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());
 }
Ejemplo n.º 3
0
 public boolean isEnabled() {
   return ua.getEnabled();
 }
Ejemplo n.º 4
0
 public String getUsername() {
   return ua.getUserId().toString();
 }
Ejemplo n.º 5
0
 public String getPassword() {
   return ua.getPassword();
 }
Ejemplo n.º 6
0
 public Collection<GrantedAuthority> getAuthorities() {
   return ua.getUserGroup().getGranted();
 }
Ejemplo n.º 7
0
 @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";
 }