Ruling upholds mass criminal immigration hearing