Salesforce allows you to control access to your data at different levels. For example, you can use object privileges to control user access to objects. Within an object, you can use field-level security to control user access to fields. Use sharing settings to control record-level access to data.
Required edition: Available in Salesforce Classic (not all Orgs) & Salesforce Lightning Both.
There are several sharing mechanisms that you can use to configure access to records for your users.
The default organization-wide sharing setting gives you a basic access level for each object and allows you to extend that access level using hierarchies or sharing rules. For example, you can set the organization-wide default to Private if you only want users to view and edit leads, they own. You can then create lead sharing rules to extend lead access to specific users or groups.
A role hierarchy automatically grants access to a record to users above the record's owner in the hierarchy. You can control share access using hierarchies for any custom object, but not standard objects.
Don't forget to check out: Access & Permissions in Salesforce | Profiles, Permission Sets, Sharing Settings
Sharing rules are exceptions to organization-wide defaults. They allow you to extend access to records to users regardless of their place in the role hierarchy. If your organization-wide sharing default setting is Public, read-only or Private, you can define rules that allow other users to access records they don't own. You can create sharing rules based on the owner of a record or the values of fields in a record.
It may not be possible to define a consistent group of users who need access to a particular set of records. Record owners can use manual sharing to grant read and edit permissions to users who otherwise don't have access. Manual sharing isn't automated like company-wide sharing settings, role hierarchies, and sharing rules. However, record owners have the flexibility to share records with anyone who needs to see them
Apex Managed Sharing
It allows developers to programmatically share custom objects. When you share a custom object using Apex managed sharing, only users with the "Modify All Data" permission can add or modify sharing on the custom object's records, and access to sharing is limited to changes to the record owner. is maintained.
Reference: pathtosalesforce, pdfcoffee