public LdapBatchDto synchronizeExistingLdapUsers(LdapBatchDto batchInfo, boolean collectIgnoredUsers) throws AmbariException {
    LOG.trace("Synchronize Existing LDAP users...");
    final Map<String, User> internalUsersMap = getInternalUsers();

    for (User user : internalUsersMap.values()) {
      if (user.isLdapUser()) {
        Set<LdapUserDto> userDtos = getLdapUsers(user.getUserName());
        if (userDtos.isEmpty()) {
          LdapUserDto userDto = new LdapUserDto();
          userDto.setUserName(user.getUserName());
          userDto.setDn(null);  // Setting to null since we do not know what the DN for this user was.
          batchInfo.getUsersToBeRemoved().add(userDto);
        } else if (collectIgnoredUsers) {
          LdapUserDto userDto = new LdapUserDto();
          userDto.setUserName(user.getUserName());
          batchInfo.getUsersIgnored().add(userDto);
        }
      }
    }

    return batchInfo;
  }
Performs synchronization of existent users and groups.

@param collectIgnoredUsers true, to collect the set of existing users that would normally be ignored;
                           false, to continue to ignore them
@throws AmbariException if synchronization failed for any reason
ambari-server/src/main/java/org/apache/ambari/server/security/ldap/AmbariLdapDataPopulator.java