You need to sign in to do that
Don't have an account?

Avoid Sharing to users who have no access to the object
His all,
Is there a way to avoid sharing records fro users who dont have access to the object.
in soql even we used with sharing keyword, records are retrieved for the users who have sharing records but not read access in profile
I would suggest you to check OWD for that object. If its public then the soql will return records.
Hi Amilaw,
How are the users doing the search ?
Regards,
Ashish
OWD is not public
code is something like this
public with sharing class TestPageController {
public List<Business_Unit__c> bus{get;set;}
public List<String>busString{get;set;}
public TestPageController()
{
bus = [SELECT Name FROM Business_Unit__c];
busString = new List<String>();
for(Business_Unit__c bu : bus)
{
busString .add(bu.Name);
}
}
}
<apex:page controller="TestPageController">
<apex:repeat value="{!bus}" var="bu">
{!bu.Name}#####################<br/>
</apex:repeat>
<apex:repeat value="{!busString}" var="bustring">
{!bustring}********************<br/>
</apex:repeat>
</apex:page>
result is something like this
#####################
#####################
#####################
#####################
BU1********************
BU2********************
BU3********************
BU4********************
Hi Amilaw,
Did you also verify if there are any Sharing Rules that override the default sharing.
Regards,
Ashish