MemberSeptember 19, 2018 at 1:54 pm
Adding some point:
When you use 'with sharing'(with Security Settings enforced) keyword the Apex code runs in User Context, i.e all the sharing rules for the current user are taken into account.
Let's say you're trying to perform an update as the user A.Now If user A cannot edit record R1, then an error will occur. If user A cannot see record R1, they cannot query that record. Use this mode when for pages that should respect sharing settings, or any other time you might want to enforce the rules.