Can anyone please explain if the class is declared as With Sharing then why do we still need to check if the User has permission for SOQL or not or the object creatable/editable etc? Please clarify. Thanks a ton in advance.

1 Answer 1


with sharing only enforces record level sharing. It does not check for field permissions or object permissions for the user. For example, it is possible to query for records on objects the user has no access to, as sharing doesn't account for profile and permission set permissions. In addition, a user can technically modify a record (e.g. the user has Edit permission for a specific record), but doesn't have profile permissions to actually update any record. As such, you always need to describe the user's permissions or use Security.stripInaccessible method to prevent modifying records/fields the user cannot edit.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .