In a last-minute ruling, a federal judge issued a restraining order on the sale of oil and gas leases near several national parks.