What happens when we use with sharing in web service class?

What happens when we use with sharing in web service class?

Apex class methods that are exposed through the API with the webService keyword don’t enforce object permissions and field-level security by default. We recommend that you make use of the appropriate object or field describe result methods to check the current user’s access level on the objects and fields that the webService method is accessing..

Also, sharing rules (record-level access) are enforced only when declaring a class with the with sharing keyword. This requirement applies to all Apex classes, including to classes that contain webService methods. To enforce sharing rules for webService methods, declare the class that contains these methods with the with sharing keyword.

Check the below link for more info

http://www.salesforce.com/us/developer/docs/dbcom_apex250/Content/apex_web_services_methods_exposing.htm

Cheers!!!

Leave a Reply