예제 #1
0
 public void deleteUserInformation(String login) {
   userRepository
       .findOneByLogin(login)
       .ifPresent(
           u -> {
             userRepository.delete(u);
             log.debug("Deleted User: {}", u);
           });
 }
예제 #2
0
 /**
  * Not activated users should be automatically deleted after 3 days.
  *
  * <p>
  *
  * <p>This is scheduled to get fired everyday, at 01:00 (am).
  */
 @Scheduled(cron = "0 0 1 * * ?")
 public void removeNotActivatedUsers() {
   ZonedDateTime now = ZonedDateTime.now();
   List<User> users =
       userRepository.findAllByActivatedIsFalseAndCreatedDateBefore(now.minusDays(3));
   for (User user : users) {
     log.debug("Deleting not activated user {}", user.getLogin());
     userRepository.delete(user);
   }
 }