A passerby who walks within view of a surveillance camera may allow himself to be photographed for the benefit of the property owner, even though the photograph is not a benefit to the passerby, if he must pass by a surveillance camera to enter the building. This is called a pesik reisha delo nicha leih (Aramaic: פסיק רישא דלא ניחא ליה, loose translation: "an inevitable resultant action that does not benefit the one who indirectly caused that action").
However, it is prohibited to walk past a motion-sensitive light on Shabbat if the street is dark and because the turning on of the light substantively benefits the person, and it is a pesik reisha denicha leih (Aramaic: פסיק רישא דניחא ליה, loose translation: "an inevitable resultant action that does benefit the one who indirectly caused that action"). One is advised to avoid walking past the motion sensor or to close one's eyes when doing so if he or she knows that the motion sensor will activate a light switch. [So says wikipedia.]