Regardless of who bought the ticket, the person flying will get the Elite Points and Avios, providing they belong to the Club Iberia Plus programme.
The exception to this rule is combined products purchased through Iberia Vacaciones or BA Holidays (Flight + Car and Flight + Hotel holiday packages): the person who purchase the package will get all the associated Elite Points (1 Elite Point for every 10 Avios collected). These Elite Points are only associated with the purchase of the holiday package.
The Elite Points and Avios associated with the flight will be collected by each passenger individually.