Beispiel #1
0
 @Override
 @Transactional
 public User removeOne(Long id) {
   User user = findOne(id);
   user.setEnabled(false);
   return save(user);
 }
Beispiel #2
0
 @Transactional
 public User save(User user, boolean changePassword) {
   if (changePassword) {
     user.setPassword(passwordEncoder.encode(user.getPassword()));
   } else if (!user.isNew()) {
     user.setPassword(findOne(user.getId()).getPassword());
   }
   return userRepository.saveAndFlush(user);
 }
Beispiel #3
0
  @Override
  @Transactional(readOnly = true)
  public List<User> findAll() {
    List<User> resultList = new ArrayList<User>();
    if (DilectuUtils.isAdministrator()) {
      resultList = userRepository.findAll();
    } else {
      List<User> userList = findByTenant(TenantContextHolder.getTenant());

      for (User user : userList) {
        if (!user.getGroup().getPermissions().contains(UserPermission.ADMIN)) {
          resultList.add(user);
        }
      }
    }

    return resultList;
  }