An option could be to filter users and groups from Nextcloud LDAP/AD connection settings (Settings -> Administration: LDAP/AD integration), when logged in as nextcloud’s admin. But prior to any change better take note of current/working settings:
sudo -u apache /opt/rh/rh-php71/root/usr/bin/php /usr/share/nextcloud/occ ldap:show-config