Why do we have this concept in salesforce?
In salesforce there are many restrictions put on user in different ways, like OWD, Profiles, Field-Level Security, Object permissions, Sharing Rules, Role Hierarchy etc. But these restrictions do not apply to System Administrator. System admin has access to all records that are in system irrespective of owner or sharing rules or access to any object or field. An apex classes can be executed by any user in salesforce. An apex class can be triggered from a Visualforce Page, Visualforce Components, Lightning Components, Process Builder, Flow and many more ways. Class in salesforce can be executed in 3 modes in salesforce
- with sharing
- without sharing
- inherited sharing
Use the with sharing or without sharing keywords on a class to specify whether sharing rules must be enforced. Use the inherited sharing keyword on an Apex class to run the class in the sharing mode of the class that called it.Continue reading “User Mode and System Mode of Apex Class in Salesforce.”