public LdapBatchDto synchronizeAllLdapGroups(LdapBatchDto batchInfo, boolean collectIgnoredUsers) throws AmbariException {
    LOG.trace("Synchronize All LDAP groups...");
    Set<LdapGroupDto> externalLdapGroupInfo = getExternalLdapGroupInfo();

    final Map<String, Group> internalGroupsMap = getInternalGroups();
    final Map<String, User> internalUsersMap = getInternalUsers();

    for (LdapGroupDto groupDto : externalLdapGroupInfo) {
      addLdapGroup(batchInfo, internalGroupsMap, groupDto);
      refreshGroupMembers(batchInfo, groupDto, internalUsersMap, internalGroupsMap, null, false, collectIgnoredUsers);
    }
    for (Entry<String, Group> internalGroup : internalGroupsMap.entrySet()) {
      if (internalGroup.getValue().isLdapGroup()) {
        LdapGroupDto groupDto = new LdapGroupDto();
        groupDto.setGroupName(internalGroup.getValue().getGroupName());
        batchInfo.getGroupsToBeRemoved().add(groupDto);
      }
    }

    return batchInfo;
  }
Performs synchronization of all 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