You need to sign in to do that
Don't have an account?
Chris Voge 9
Sharing Rules are not enforced when querying ListView object
Hello,
I'm trying to populate a lightning select component with
a list of list views. It's retrieving ALL list views instead of what
the current user has access to.
I would expect the "with sharing" in the class would enforce the
sharing rules. The "getListViews" method is being called from a lightning
controller (JavaScript code). Can someone investigate ? (See Below)
Thanks, Chris
I'm trying to populate a lightning select component with
a list of list views. It's retrieving ALL list views instead of what
the current user has access to.
I would expect the "with sharing" in the class would enforce the
sharing rules. The "getListViews" method is being called from a lightning
controller (JavaScript code). Can someone investigate ? (See Below)
Thanks, Chris
public with sharing class LX_Controller { @AuraEnabled public static List<ListView> getListViews( String sObjectType) { List <ListView> listviews = (List <ListView>)Database.query('SELECT Id, Name, SobjectType FROM ListView WHERE SobjectType =\'' + sObjectType + '\''); return listviews; } ... }
Change your code as shown below ..
Select Id , CreatedById from ListView where CreatedById=: