Questions tagged [with-sharing]
Use the with sharing or without sharing keywords on a class to specify whether or not to enforce sharing rules.
29 questions
0 votes
0 answers
46 views
Handling FLS and Sharing Conflicts in Apex Utility Classes for Mixed User Contexts
We are developing a Salesforce managed package with multiple features sharing utility classes. Feature X: Can enforce with sharing and FLS safely. Feature Y: Accessed by guest users, cannot enforce ...
-1 votes
1 answer
338 views
With Sharing and Without Sharing scenario
I have recently started learning about apex security. I have one scenario where I'm not able to tell the exact outcome even after going through a lot of articles and youtube videos. Scenario: When '...
-1 votes
2 answers
762 views
Why default mode of Apex class run as with sharing when used with LWC while this is not a case otherwise?
Suppose I have an object with OWD set to private and I have given Read/Create Permission to a standard user now that user can only see his records (In apex class I haven't defined any mode).While this ...
-1 votes
1 answer
352 views
How partner users with same account are getting access to each other's records
I want to check how two partner users with the same account are getting access to each other's partner record. Owd of user object - private No sharing rules on user object. Also, when i query ...
0 votes
1 answer
69 views
Will there any impact of Account Public read only to private in apex class failures
We have OWD for Account as Public Read Only, but there is a requirement that we need to make an account for Private. When we do that, the user will see only what they own and whatever they earn from ...
0 votes
1 answer
104 views
Validate OWD, with sharing, Profile, Permission Sets as Non - ADMIN user
I am trying to validate the OWD for an object that is Public/Read Write without Read permission at the object level for a specific profile user. To validate the results I created a new profile by ...
1 vote
1 answer
597 views
Not getting access related errors while updating records from LWC and with sharing apex
I am trying to update records which I don't have update access on. I am expecting to get errors for such records but it updating successfully. my org object owd is public read only and profile access ...
0 votes
1 answer
211 views
Unable to pass checkmarx security review
When I use 'Without Sharing' Keyword with class in a managed package and install it in a destination org or sandbox, the code works fine but get error in the checkmarx report. If I replace 'without' ...
4 votes
0 answers
976 views
With Sharing appears to be enforcing object level security and field level security
We ran into a strange issue today. We have an Apex trigger that is calling an Apex service class. The service class was using with sharing and in our testing, users were able to create records even ...
0 votes
1 answer
412 views
Changing Case Owner in With sharing class
I have few question on "with Sharing" and "without Sharing" keyword in apex, In my Org the OWD for case is Public read only. I have one class where i am updating owner id of the ...
0 votes
1 answer
3k views
Identify in which mode(System/User mode) the class is running
From the Salesforce security review point of view for the the app exchange app, we need to add the access checks while querying and doing DML operations. If we have a requirement that the SOQL/DML ...
5 votes
1 answer
9k views
WITH SECURITY_ENFORCED and Security.stripInaccessible in a single SOQL
Premise: I followed WITH SECURITY_ENFORCED, Security.stripInaccessible and comparison before designing my Apex class for querrying a few records. Doubt: I implemented my SOQL as Security....
2 votes
1 answer
669 views
Aura Controller "with sharing" is still acting as without sharing and allows deletion
Current Setup: I have an Aura controller which uses "with sharing" and a method deletes a lead using the Id. I set up a user with profile with no Delete access. I have also revoked "...
0 votes
1 answer
157 views
Class declared as With Sharing then why Permission check?
Can anyone please explain if the class is declared as With Sharing then why do we still need to check if the User has permission for SOQL or not or the object creatable/editable etc? Please clarify. ...
1 vote
2 answers
4k views
User without CRUD permission is able to create record in 'With Sharing' class
I have a patient object , related to Account (lookup relationship). Profile 'Standard User' doesn't have CRUD permissions on the patient object. In Account trigger, I call call 'accounthandler.cls' ...