I understand
with sharing
classes run in User Mode, meaning they respect permissions, field-level security and sharing rules of the current user.I understand
without sharing
classes run in System Mode, and they ignore permissions, field-level security and sharing rules of the current user.
But I've noted that the relevant Salesforce docs say nothing about Triggers or the classes called inside them (which I understand to be in the same execution context as the record operations that fired them)
There's a post here that suggests "the trigger still runs in system context" https://developer.salesforce.com/forums/ForumsMain?id=906F0000000904ZIAQ
What if I have a controller class without sharing
doing DML causing a Trigger to be fired?
What if I have a controller class without sharing
containing logic that starts a Batch job?
What I'm asking is, if (for example) the Site Guest User
(a relatively unpowerful user in terms of sharing) causes a Trigger or Batch job to be fired, does that execution context have just as much clout as me causing it as a System Administrator
from a Visualforce Page?