Salesforce security and sharing model tutorial
On this page (8 sections)
Lesson 1: The four layers of securityLesson 2: Org-wide defaults and the role hierarchyLesson 3: Opening up access: sharing rules, teams and manual sharingLesson 4: Profiles, permission sets and field-level securityWhat changed in 2025–26How this is asked in interviewsPractise this topicCommon questionsSalesforce security works in layers: who can log in, what objects and fields they can use, and which records they can see. Interviewers ask about it in almost every admin and developer interview.
In this topic: Lesson 1: The four layers of security · Lesson 2: Org-wide defaults and the role hierarchy · Lesson 3: Opening up access: sharing rules, teams and manual sharing · Lesson 4: Profiles, permission sets and field-level security
Lesson 1: The four layers of security
| Layer | Controls | Main tools |
|---|---|---|
| Org | Who can log in, from where and how | Users, MFA, login IP ranges, login hours, session settings |
| Object | Which objects a user can create, read, edit or delete | Profiles, permission sets, permission set groups |
| Field | Which fields a user can see or edit | Field-level security in profiles and permission sets |
| Record | Which individual records a user can see | Org-wide defaults, role hierarchy, sharing rules, teams, manual sharing |
A user needs access at every layer. For example, to edit an account, they need edit permission on the Account object, edit access to the fields, and access to that specific record.
Lesson 2: Org-wide defaults and the role hierarchy
Organisation-wide defaults (OWD) set the baseline access to records owned by other people: Private, Public Read Only, or Public Read/Write. Set them to the most restrictive level any user needs, then open access with the tools below.
The role hierarchy lets users see records owned by people below them. A sales manager sees their team's opportunities. Roles are about data visibility, not job titles, so keep the hierarchy as simple as possible.
Set OWD in Setup under Sharing Settings. You can set separate external defaults for Experience Cloud users.
Lesson 3: Opening up access: sharing rules, teams and manual sharing
- Owner-based sharing rules: share records owned by one group with another (for example, East sales team's accounts with the East support team).
- Criteria-based sharing rules: share records that match field values (for example, all accounts where Industry = Healthcare with the healthcare specialists group).
- Account, opportunity and case teams: give named people access to a specific record with a role on the team.
- Manual sharing: the owner (or someone above them) shares one record with a user or group.
- Apex managed sharing: code creates share records for rules too complex for configuration.
Sharing can only open access, never take it away below what OWD gives. To restrict access to some records for some users, start with a more private OWD. Restriction rules are an exception: they can limit which records certain users see on supported objects.
Lesson 4: Profiles, permission sets and field-level security
Profiles and permission sets grant object permissions (create, read, edit, delete, view all, modify all) and field-level security. A user has exactly one profile and any number of permission sets.
Permission set groups bundle permission sets for a job role, and a muting permission set inside a group can remove a permission from that bundle.
Tip: When a user says "I can't see the field", check in this order: field-level security, page layout or Dynamic Forms visibility, record type, and then whether they can see the record at all.
What changed in 2025–26
- Permission sets first: Salesforce recommends minimal profiles and giving access through permission sets and permission set groups.
- Restriction rules can narrow which records users see, even when sharing would allow more.
- Multi-factor authentication is required for all users who log in to the user interface.
- User mode in Apex makes custom code respect the same permissions and sharing that users have in the UI.
How this is asked in interviews
- "Role or profile?" Profiles and permission sets: what you can do. Roles: which records you can see.
- "A user can't see a record. How do you troubleshoot?" Check object access, org-wide default, role, sharing rules, then use Sharing Hierarchy on the record.
- "How would you secure an org from scratch?" Strict org-wide defaults, then open access with roles, rules and permission sets.
- See security interview questions.
How to answer: Start with what you would do, say why, mention the limit or risk you are avoiding, and finish with a real example from a project or practice org. One clear minute beats five minutes of definitions.
Practise this topic
- Hands-on practice project: build a complete app, with model answers
- Salesforce security interview questions
- Admin interview questions
- Admin mock interview
Common questions
01What is the difference between a role and a profile?
What is the difference between a role and a profile?
A profile controls what a user can do (objects, fields, system permissions). A role controls which records they can see through the role hierarchy.
02Can sharing rules restrict access?
Can sharing rules restrict access?
No. Sharing rules only grant extra access above the org-wide default. To restrict, make the org-wide default more private and open access selectively.
03What does View All Data do?
What does View All Data do?
It lets a user see every record in the org regardless of sharing. Give it only to admins and integration users that truly need it.