Loading
Enhance Salesforce with Code
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          How Does Apex Class Security Work?

          How Does Apex Class Security Work?

          Limit which users can execute methods in a particular top-level Apex class based on their profiles or an associated permission set. This technique lets you apply granular security to Apex operations in your org.

          Required Editions

          Available in: both Salesforce Classic (not available in all orgs) and Lightning Experience
          Available in: Performance, Unlimited, Developer, Enterprise, and Database.com Editions

          You can set Apex class security via:

          • The Apex class list page
          • An Apex class detail page
          • Permission sets
          • Profiles

          These permissions apply only to any Apex class methods(including web service methods) used in a custom Visualforce controller or controller extension that’s applied to a Visualforce page. In contrast, triggers always fire on trigger events (such as insert or update), regardless of a user’s permissions.

          Note
          Note If you’ve installed a managed package in your org, you can set security only for the Apex classes in the package that are declared as global or for classes that contain methods declared as webService.

          If users have the Author Apex permission, they can access all Apex classes in the associated organization, regardless of the security settings for individual classes.

          Permission for an Apex class is checked only at the top level. 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. Likewise, if a Visualforce page uses a custom component with an associated controller, security is only checked for the controller associated with the page. The controller associated with the custom component executes regardless of permissions.

           
          Loading
          Salesforce Help | Article