US judge orders restoration of AP's access to Trump events