Activity Forums Salesforce® Discussions How to apply Security of logged in user on Apex & VF in Salesforce page

  • ABHISHEK

    Member
    June 18, 2019 at 8:25 pm

    Apex class can be written in two category:-

    1. With sharing keyword:- If you declare a class as a With Sharing, Sharing rules given to the current user will be taken into the consideration and the user can access or perform the operations based on the permissions given to him on object and fields (Field Level Security, Sharing rules).
    2. Without sharing keyword:- If you declare a class as a Without Sharing, then this Apex class runs in system mode which means Apex code has access to all the objects and field irrespective of current users sharing rules, field level security and Object Permissions.

    Ideally, for visualforce page, apex classes should run in with sharing to enable permission applicable for a user based on their profile.

    Thanks

    Abhishek shahi

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos