Judge sides with New York Times in challenge to Trump administration policy limiting reporters’ access to Pentagon