+ Start a Discussion
Anuj Joshi 42Anuj Joshi 42 

converting without sharing controllers to with sharing controllers

Hi all,

I have few controllers which are declared as without sharing. When I run checkmarx report it states that they should be declared as with sharing. I would like to know whether changing it to with sharing will have any impact or not.

Dmitry OfitserovDmitry Ofitserov
Hi Anuj,
The "without sharing" means that the controller can run in any user's context (for example - any user who opens up a visualforce page).
Changing the keywords to "with sharing" means that the controller will run ONLY for user with whom it was shared to and will not execute for any others.
If you change it to "with sharing" you will have to update all the relevant user Profiles to have access to this controller which can be done in "Apex Class Access" section on the Profile.

Please let me know if you have any further questions.