A liquid foam is a dispersion of gas bubbles in a liquid matrix containing surface-active agents. Its flow involves the relative motion of bubbles, which switch neighbours during a so-called topological rearrangement of type 1 (T1). The dynamics of T1 events, as well as foam rheology, have been extensively studied, and experimental results point to the key role played by surfactants in these processes. However, the complex and multiscale nature of the system has so far impeded a complete understanding of the mechanisms involved. In this work, we investigate numerically the effect of surfactants on the rheological response of a 2D sheared bubble cluster. To do so, a level-set method previously employed for simulation of two-phase flow has been extended to include the effects of surfactants. The dynamical processes of the surfactants – diffusion in the liquid and along the interface, adsorption/desorption at the interface – and their coupling with the flow – surfactant advection and Laplace and Marangoni stresses at the interface – are all taken into account explicitly. Through a systematic study of the Biot, capillary and Péclet numbers that characterise the surfactant properties in the simulation, we find that the presence of surfactants can affect the liquid/gas hydrodynamic boundary condition (from a rigid-like situation to a mobile one), which modifies the nature of the flow in the volume from a purely extensional situation to a shear. Furthermore, the work done by surface tension (the 2D analogue of the work by pressure forces), resulting from surfactant and interface dynamics, can be interpreted as an effective dissipation, which reaches a maximum for a Péclet number of order unity. Our results, obtained at high liquid fraction, should provide a reference point, with which experiments and models of T1 dynamics and foam rheology can be compared.