function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Krishna VKrishna V 

is Assigning modify all data permission to a user same as having that user invoke Apex/ flows that run in without sharing context?

I have a basic question, we have a lightning component on an object that we use to let users approve records in the approval process without them being the approvers. For this to work, we assigned 'Modify all' on object to users who need to approve these records through a permission set, but this is opening up more access than needed to users, the apex class behind the lightning component implements with sharing currently, Can we change it to without sharing and would that be same as Modify all on the object but just in the context of the class invocation? 
Best Answer chosen by Krishna V
AnkaiahAnkaiah (Salesforce Developers) 
Answer is Yes.

The with sharing keyword allows you to specify that the sharing rules for the current user be taken into account for a class. You have to explicitly set this keyword for the class because Apex code runs in system context. In system context, Apex code has access to all objects and fields— object permissions, field-level security, sharing rules aren’t applied for the current user. This is to ensure that code won’t fail to run because of hidden fields or objects for a user. The only exceptions to this rule are Apex code that is executed with the executeAnonymous call and Chatter in Apex. executeAnonymous always executes using the full permissions of the current user.

Use the without sharing keywords when declaring a class to ensure that the sharing rules for the current user are not enforced. For example, you may want to explicitly turn off sharing rule enforcement when a class acquires sharing rules when it is called from another class that is declared using with sharing.

Refer the below article.
https://developer.salesforce.com/docs/atlas.en-us.200.0.apexcode.meta/apexcode/apex_classes_keywords_sharing.htm#:~:text=Use%20the%20without%20sharing%20keywords,is%20declared%20using%20with%20sharing%20.

'Modify All Data' permission:
Full Access on all objects (Ignores sharing and any other security)
Refer the below help article.
https://help.salesforce.com/s/articleView?id=000321298&type=1 (https://help.salesforce.com/s/articleView?id=000321298&type=1)

If this information helps, Please mark it as best answer.

Thanks!!