Testing the Security Model
Chapter 13 of Securing Salesforce: Sharing and Visibility, Part 2: The File Cabinets: Sharing Records. New to the course? Start with chapter 1.
Chapters 6 to 12 built the file cabinets: who owns what, who sits above them, the rules, the teams, the code, and the data that isn’t a record. This chapter asks the question every one of them leaves open. How do you know it works?
Most people test sharing once, as the person who should see the record. That’s half a test. A sharing model is only as good as the proof that it works, for the people who should see a record and, more important, for the people who shouldn’t.
The ideas in this chapter
Section titled “The ideas in this chapter”- Three users. One to own, one to share, and the side effects. Two users only prove the positive; the third tells you if it’s secure.
- Start with the null test. Prove that nothing is shared before you share anything.
- Test the blocks, then the people. Each team’s permission sets at each level, then each persona’s assembled group as a real user, then the records.
- Write the expected result first. If you write it after you test, you’ll write down whatever happened.
- Keep the proof running. Run-as tests prove what each user sees, in code, on every deployment.
- Evidence answers why. View Summary, the Sharing Hierarchy, UserRecordAccess and the share table, each with something it doesn’t show.
- Troubleshoot in order. The object, the default, the grants, then what takes access away.
- Prove the fix, and test again when the owner, a role or a rule changes.
The picture
Section titled “The picture”Here’s where the chapter starts: one sharing requirement, tested properly.
And here’s how you show your work: four questions, four places to look, and what each one misses.
The path through this chapter
Section titled “The path through this chapter”Six modules, each standing on its own.
- Three Users: Prove the Positive and the Negative. Why three; the null test; the side effects up the hierarchy, the access level and every door; what to test again when something changes.
- Persona Test Plans: Test the Permission Sets, Then the People. Each subsystem’s permission sets at each level; each persona as a real user; the plan as a table, with the expected result written first.
- Run As in Apex Tests: Keep the Proof Running. What runAs enforces and what it doesn’t; building test users; the three users in code; what a run-as test can’t see.
- The Evidence: Who Can See It, and Why. View Summary and Access Granted By; the Sharing Hierarchy and its reasons; UserRecordAccess; the share table; the Public Group Access Summary.
- Why Can’t This User See the Record?. Salesforce’s troubleshooting path in four steps; the other direction; fields; the traps; external users.
- Checkpoint 2: Build It, Then Prove It. Steve Trucking’s internal model finished with a rule per partner, manifests shared in a flow, and files on their records, then proved persona by persona. Try the challenge first.
Then check what stuck with the study guide.
What an architect decides here
Section titled “What an architect decides here”- For each sharing requirement, the three users, written down, with the managers above them and the doors to check.
- For each subsystem, the permission set tests its team ships, and for each persona, a test user built like a real one.
- The test plan: its rows, the expected results, who signs off, and where it lives.
- Which code and flows have run-as tests, for the user who should see and the user who shouldn’t, on both doors.
- The evidence each test records, and which second tool confirms it.
- The troubleshooting order the team follows, and that every fix ends with the three users.
- What reruns the tests: owner changes, role changes, new users, new rules, and every release that touches sharing.
Beyond the exam: what AI changes. An agent is one more user, so it gets the same three users, the same row in the test plan and the same evidence. And Salesforce now suggests asking the Setup agent who can see a record and why. Use it to find the answer faster, then check it with the evidence tools before it goes in the plan. An answer from an agent is a claim; the test and the evidence are the proof. Chapter 20 covers agents.
Explore
Section titled “Explore”Each module lists its own sources, each checked 2026-11-07. Two to start with:
- Viewing Which Users Have Access to Your Records in Lightning Experience (opens in a new tab), Salesforce Help (checked 2026-11-07)
- Using the runAs Method (opens in a new tab), Apex Developer Guide, Winter ‘27 (checked 2026-11-07)
Next: External Users: Sites, Communities, Licenses and Roles (coming soon)
