We want certain user profiles to have access to VF without changing any profile permissions. VF page when accessed shows Data not available. I granted vf and apex class access to profile and when queried using SetupEntityAccess shows page access is granted to the user.

I am trying to show the related list of account. But here account is in private sharing model. We would want to retain that sharing model but still give users access thru visualforce pages to view them. It would be great if you can let me know if it is at all feasible thru development and how

Edit - I have 'Without sharing' in my apex class

  • 1
    you need to make your controller class without sharing mode. – Ratan Paul Mar 1 '16 at 11:40

Be careful when doing this as you're bypassing security.

As Ratan said you'll need to add "without sharing" to your Apex class to access the records inside Apex.

Visualforce also enforces sharing though and that cannot be disabled as easily. To do so you can use a wrapper class. You won't be able to use the standard related list components but could make your own using pageBlockTable and looping through your wrapper class.


I had to change that to custom Controller instead of standard and it worked.

  • You may have introduced a security risk by doing so. Know that this solution shouldn't be done without careful consideration as to why you do not want to change profile permissions, but still allow people to access and/or modify data. Test that your users can't abuse this to access data you do still not want them to access! – Samuel De Rycke Mar 2 '16 at 11:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.