6

When you use with sharing keyword in an apex class, and try to query an object which doesn't have read permission on the profile, what would happen? Would it still show some results? The results would depend on the Organization-Wide Default and other record-level sharing configuration for that user. The fact that they do not have read access at the object ...


5

It's a System.NoAccessException. The message is: No access to entity: MyObject__c Not sure the easiest way to verify, but I set up a Visualforce Page with the below controller so the running user didn't need appropriate permissions to execute anonymous Apex. public with sharing class Demo { public String type { get; private set; } public String ...


5

There are several blog posts on this, but this one is probably the most relevant: https://www.learncommunitycloud.com/s/news/guest-user-record-access-development-best-practices-20Y1U000000UkITUA0 The basic goal is to prevent unauthenticated users updating data since that is considered a security risk. Assuming you need the Guest Site User to be able to ...


3

The main problem at hand is determining which fields to include in a query. Since this is, by necessity, a runtime calculation, we'll still need to use dynamic soql (i.e. Database.query(querystring)) The WITH_SECURITY_ENFORCED keyword for SOQL appears to throw an exception if an inaccessible field is requested. Exceptions as flow control are a bad idea, ...


3

When you use with sharing keyword in an apex class, and try to query an object which doesn't have read permission on the profile, what would happen? Would it still show some results? Yes, it could theoretically show some results. Sharing is always calculated as if the user has access to the object, so if any records could be seen if the user has permission, ...


2

Yes, the Field History feature respects both Sharing Access and Field Level Security. You can't report on records you can't see, and you can't find values in fields you cannot access. The Field History Tracking documentation suggests this. If a trigger causes a change on an object the current user doesn’t have permission to edit, that change is not ...


Only top voted, non community-wiki answers of a minimum length are eligible