Apex Developer Guide
Release Notes
SOQL For Loops
Enforce Sharing Rules
Class Security
Custom Settings
Apex Reference
Previous PDF Versions
DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!
Let us know so we can improve!
You can specify which users can execute methods in top-level classes or Apex transaction entry points based on their user profile or permission sets. You can only set security on Apex classes, not on triggers.
Class security applies to methods that are in top-level Apex classes. For example, class A calls class B. User X has a profile that can access class A but not class B. User X can execute the code in class B, but only through class A; user X cannot invoke class B directly.
Class security also applies to methods that are in Apex transaction entry points, such as:
@AuraEnabled methods called from Lightning web componentsFor example, if a Lightning web component calls an Apex class, security is only verified for that primary class. If that class calls a secondary class the user doesn’t have explicit permission to access, the user can still execute that code in the secondary class, but only through the primary class.
To set Apex class security from the class list page, see Set Apex Class Access from the Class List Page
To set Apex class security from the class detail page, see Set Apex Class Access from the Class List Page
To set Apex class security from a permission set:
Permission Sets in the Quick Find box, then select Permission Sets.To set Apex class security from a profile:
Profiles in the Quick Find box, then select Profiles.