SHARING-AND-VISIBILITY-DESIGNER practice question 28 of 30
How should the Architect ensure that OBJECT-LEVEL SECURITY is enforce within a custom Visualforce application that was a standard Apex controller on the Lead object?
Full set: 212 questionsStandard controllers in Visualforce automatically enforce object-level and field-level security. However, to prevent rendering errors or showing UI components that a user should not see, the Visualforce page itself should check for accessibility. The {!$ObjectType.lead.accessible} global variable is a direct and efficient way to check if the current user has at least read access to the Lead object before attempting to render related content. This ensures the UI respects the user's object-level security settings.
A. The runAs() method is used exclusively within Apex test classes to validate code behavior in different user contexts; it does not enforce permissions in production code.
B. The isAccessible() method is used in Apex, typically within custom controllers, to programmatically check permissions. It is not the standard way for a Visualforce page using a standard controller.
D. The "With Sharing" keyword is used to define an Apex class, forcing it to respect the user's record-level sharing. It is not a directive used on a Visualforce page.
1. Salesforce Developers Documentation, Visualforce Developer Guide, "$ObjectType" section. It states, "$ObjectType.ObjectName.accessible: Returns true if the user has read access to the object, and false otherwise."
2. Salesforce Developers Documentation, "Enforcing CRUD and FLS" page. It highlights using $ObjectType and $Schema.SObjectType global variables for checking object and field accessibility in Visualforce pages.
Keep practicing
Take the free SHARING-AND-VISIBILITY-DESIGNER practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other SHARING-AND-VISIBILITY-DESIGNER practice questions
- Question 1Universal Containers is a fast-growing company that sells containers globally. It has tho…
- Question 2Universal Containers uses 75,000 distributors that have close to 1 million total users. D…
- Question 3Universal Containers would like to create a custom team solution that can be used on a cu…
- Question 4Universal Containers has a private sharing model on Accounts. Apex Managed Sharing is req…
- Question 5Universal Containers keeps product brochures in Salesforce as files. Sarah shares a publi…
- Question 6What is the best practice for testing sharing and visibility changes?
