Lecture 4 Salesforce Security Model
Lecture 4 Salesforce Security Model
In this lecture we will learn how to secure your Salesforce organization by controlling
exactly what data your users have access to within it.
There are 4 main levels in Salesforce Security Model:
All blocks here are listed in order of increasing access. You use org-wide defaults to lock
down your data to the most restrictive level, and then use the other record-level security
tools to grant access to selected users, as required.
1. Org –Wide Defaults.
In Salesforce, records have a field called “OwnerId” that points to a real user.
Owners of records are usually people who created the record and have full CRED
access to it. Organization-wide defaults (OWD) control the default behavior of
how every record of a given object (for example, Accounts) is accessed by users
who do not own the record. OWD answers the question: “Who else except the
owner?”
There are several most common types of OWD:
- Private (Only the record owner, and users above that role in the hierarchy, can
view, edit, and report on those records.)
- Public Read Only (All users can view and report on records, but only the owner,
and users above that role in the hierarchy, can edit them.
- Public Read/Write (All users can view, edit, and report on all records)
- Controlled by Parent (A user can view, edit, or delete a record if she can perform
that same action on the object it belongs to.)
You use organization-wide sharing settings to lock your data to the most restrictive
level. Then you will be able to use other record-level security and sharing tools to
selectively give access to other users.
For example, users have object-level permissions (on Profile) to read and edit
opportunities, and the organization-wide sharing setting is Read-Only. By default,
those users can read all opportunity records, but can’t edit any unless they own the
record or are granted other permissions. Organization-wide defaults are the only
way to restrict user access to a record. Related Trailhead , Useful GIF
2. Role Hierarchy.
Typically, in an organization, different job roles have different record access
requirements. Users who need to see a lot of data (such as the CEO, executives, or
other management) often appear near the top of the hierarchy. But role hierarchies
don't have to match your org chart. Each role in the hierarchy just represents a
level of data access that a user or group of users needs.
Let's imagine you have a newcomer to sales executive team named Maria. You
need to Find a proper place for here in your Role Hierarchy. Check this GIF on
how to achieve that.
Users higher in a hierarchy (role or territory) inherit the same data access as their
subordinates for standard objects. Managers (for e.g. Maria ) gain as much access
as their subordinates. If the subordinate has read-only access, so will the manager.
This access applies to records owned by users, as well as records shared with them.
What about custom Objects? By default, the Grant Access Using Hierarchies
option is enabled for all objects. It can only be changed for custom objects.
Related Trailhead
3. Sharing Rules
Hierarchy-based sharing (we learned above) only works for sharing upward and in
a vertical direction. What if we want to share laterally? For example, what if we
want to share records that Maria owns (records of sales executive team) with her
peers in the service executive teams? This is where sharing rules come in. Sharing
rules provide a way to share records laterally and in an ad-hoc fashion via public
groups.
Let’s look into the details:
Ownership-based sharing rules let admins share records based on role, role-and-
subordinate, and public group ownership. For example, we can share all the
records owned by anyone in a sales executive role (including Maria’s) with
everyone in a service executive role. Similarly, we can share all the records owned
by the sales executives, and their subordinates, with others as well.
The GIF shows how different ownership-based sharing works for our use case.
Note that the public group is an ad-hoc group of individual users, users in various
roles, and other public groups. Sharing with public groups provides a highly
flexible way to share records.
Criteria-based sharing rules let users access records based on the value of a field
in a record, irrespective of who owns the record. For example, if Maria wants to
meet with all accounts in San Francisco, an admin might set a criteria-based
sharing rule to share with Maria all accounts whose billing city is San Francisco.
Useful GIF,
[IMPORTANT] Sharing Rules open up records access to users when OWD is set
to anything more restrictive than Public Read/Write. Related Trailhead
4. Manual Sharing
Manual sharing provides a mechanism to share individual records with others. This
permission is accessed through the Sharing button on the record details page, and
lets end-users share individual record with others. [IMPORTANT]: This is only
available if the OWD is private or public read-only because otherwise (say public
read/write), you wouldn’t need it. Useful GIF, Related Trailhead
5. Teams
For accounts, opportunities, and cases, record owners can use teams to allow other
users access to their records. A team is a group of users that work together on an
account, sales opportunity, or case. Record owners can build a team for each
record that they own. The record owner adds team members and specifies the level
of access each team member has to the record, so that some team members can
have read-only access and others can have read/write access. The record owner can
also specify a role for each team member, such as “Executive Sponsor.” In account
teams, team members also have access to any contacts, opportunities, and cases
associated with an account. Related Article
4 LEVEL: FIELD LEVEL SECURITY
In some cases, you want users to have access to an object, but limit their access to
individual fields in that object. Field-level security settings—or field permissions—
control whether a user can see, edit, and delete the value for a particular field on an
object. These are the settings that allow us to protect sensitive fields such as a candidate's
social security number without having to hide the candidate object. For example, an
object can have 20 fields, but field-level security can be set up to prevent the users from
seeing five of the 20 fields.
In Salesforce, profiles and permission sets also control field-level access. An admin can
provide read and write permissions for individual fields. An admin can also set a field to
hidden, completely hiding removing access to the field from specific user. When you
hide a field with field-level security , the field won’t be accessible through any entry
points (for instance via API). The recommended security best practice is to use field-level
security instead of just removing a field from a page layout. Just as with object-level
security, we recommend to configuring field-level security using permission sets and
permission set groups.
The graphic here shows how you provide field-level access through a permission set.
Related Trailhead
SUMMARY
Salesforce provides four layers of security with lots of flexibility to accommodate
virtually any business need. Profiles and permission sets controls object-level and field-
level access. Further, there are five types of record-level security: org-wide defaults, role
hierarchy sharing, sharing rules, manual sharing, and teams sharing. These five control
access to sets of records or even an individual record to people who don’t own those
records.
Keep in mind that permissions on a record are always evaluated according to a
combination of object-level, field-level, and record-level permissions. When object-level
permissions conflict with record-level permissions, the most restrictive settings win.