A judge warned the NYPD that it may have violated protesters’ rights.