2

I am following the trigger framework explained in this image: Link

In this case, Do I need to add every profile to the AccountHelper class security?

My AccountHelper class does not have with sharing keyword.

I am little confused here..I know that when we design a VF page, we need to add every profile to the VF page and no need for controller.

In the above case, Do I need to add the profiles to the Apex class security?

javanoob
  • 8,867
  • 14
  • 75
  • 138

2 Answers2

2

Apex class security applies to these use cases (from the doc):

You can specify which users can execute methods in a particular top-level Apex class based on their profile or an associated permission set. These permissions only apply to Apex class methods, such as Web service methods, or any method used in a custom Visualforce controller or controller extension applied to a Visualforce page. Triggers always fire on trigger events (such as insert or update), regardless of a user's permissions.

So, for triggers, no need to worry about this

cropredy
  • 71,240
  • 8
  • 120
  • 270
1

As a best practice, it would be wise to add with sharing to the class. Without seeing your code, I can't answer whether or not you need to add the profiles, but somehow I doubt you would based on the fact it would be called in the context of the sharing for VF Page execution that eventually causes it to be called.

For a good discussion on the subject, I'd recommend you read a question I asked Does "with sharing" only apply to 1st entry point of code? along with the link in that question to Without Sharing: Best practices when bypassing Apex sharing rules and object security and @SFDCFox's answer to my qustion.

crmprogdev
  • 40,955
  • 9
  • 58
  • 115