if the register owner is in the car but someone else is driving who has the legal right to give a cop permission to search the vehicle
Either ... the owner always can ... the driver is assumed to have the owner's permission to "control the vehicle", which includes giving permission to such things as searches.
I would assume the driver since he is the one who was driving and got pulled over.
The driver. They are in possession of the vehicle at that point in time.
I would ask the owner since he/she is right there! Driver operating the car, if the owner was not there, yes the driver can give permission!