  Controlled heat transfer and thermal rectification in a system of two coupled
cavities connected to thermal reservoirs are discussed. Embedding a
dispersively interacting two-level atom in one of the cavities allows switching
from a thermally conducting to resisting behavior. By properly tuning the
atomic state and system-reservoir parameters, direction of current can be
reversed, which violates the second law of thermodynamics. It is shown that a
large thermal rectification is achievable in this system by tuning the
cavity-reservoir and cavity-atom couplings. Partial recovery of diffusive heat
transport in an array of $N$ cavities containing one dispersively coupled atom
is established.
