Questions tagged [with-sharing]

Use the with sharing or without sharing keywords on a class to specify whether or not to enforce sharing rules.

Filter by
Sorted by
Tagged with
2
votes
1answer
35 views

Do we have to force all FFLIB classes with `with sharing` keywords to pass security review?

I'm using FFLIB classes in my managed package and i just wanted to know if i should mark FFLIB classes use in my package with with sharing keyword to follow security review requirements ? Thanks,
2
votes
2answers
70 views

with and without sharing with innerclass

I'm working on a project that needs to change a lot of data that the user shouldn't see in the backoffice. So I'm wondering if I should put my entire class "without sharing". For now I'm creating a "...
0
votes
1answer
843 views

INVALID_CROSS_REFERENCE_KEY: Record Type ID: this ID value isn't valid for the user: (RecordTypeId)

I do know that we can use "without sharing" when we dont want to apply the sharing rules of the current user to set the values, but my class has nothing after access modifiers, just public class ...
1
vote
1answer
113 views

`sharing` / `without sharing` keywords inheritance behaviour

I have a doubt regarding sharing mechanism in Salesforce. If we have these classes: public without sharing class Ctrl1 { } public with sharing class Ctrl2 extends Ctrl1 { } By reading the ...
2
votes
1answer
261 views

Sharing Setting - Contact - Controlled by Parent - Community - SOQL -Apex With Sharing

In my org, we have 5 contact matching 'dummy record'. When we use SOQL in community pages. It shows only one records. Sharing setting Contact : Controlled by Parent Account : Public read/write ...
0
votes
1answer
179 views

Limit SOQL results using 'with sharing' in Controller does not limit returned data for Pricebooks

I am running a SOQL query in a controller where I have declared 'with sharing' at the class level. The returned results are not following the sharing rules setup for the current user. The sharing ...
2
votes
0answers
74 views

Community Plus User - Contact sharing via SOQL does not match List View

In my Visualforce Page, I just use the following code to get a name list of contacts that the current user can visit. public with sharing class TestClass{ public String getAllContactNames(){ ...
0
votes
1answer
87 views

Not able to access CronJobDetail object when class is With sharing mode

I am not able to access CronJobDetail object when my class is in with sharing mode. Getting the below error: sObject type 'CronJobDetail' is not supported. Any idea? Thanks!
9
votes
1answer
153 views

Read access denied: getQueryLocator(soql) vs. query(soql)

I am attempting to add pagination, and I followed this great article by Jeff Douglas. I am an admin so when I run the page it runs great, I can navigate forwards, back. When I log in as a user my ...
13
votes
3answers
941 views

What's It Called: Inner Class Without Sharing?

I believe I have heard a specific term for this pattern, but I am not able to retrieve it from the foggy banks of my memory: public with sharing class OuterClass { public without sharing class ...