Esempio n. 1
0
 @ResponseStatus(HttpStatus.NO_CONTENT)
 @RequestMapping(method = RequestMethod.PATCH, consumes = MediaType.APPLICATION_JSON_VALUE)
 public void changePassword(@RequestBody ChangePasswordCommand cmd, User user) {
   Assert.isTrue(user.getLogin().isPresent(), "Only users with login can update his/her password");
   userRepository.updatePassword(user.getLogin().get(), cmd.getPassword());
 }
Esempio n. 2
0
 @ResponseStatus(HttpStatus.NO_CONTENT)
 @RequestMapping(method = RequestMethod.DELETE)
 public void delete(User user) {
   Assert.isTrue(user.getLogin().isPresent(), "Only users with login can delete his/her account");
   userRepository.delete(user.getLogin().get());
 }
Esempio n. 3
0
 @RequestMapping(method = RequestMethod.GET)
 public @ResponseBody UserInfo userInfo(User user) {
   return new UserInfo(user.getUid(), user.getLogin(), user.getAuthorities());
 }