Add WITH SYSTEM_MODE to fflib_AppBindingsSelector class
This should avoid the requirement of adding read permission to the custom medata object. Particular for external users
This commit is contained in:
+37
-44
@@ -28,41 +28,35 @@
|
|||||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
public virtual without sharing class fflib_AppBindingsSelector extends fflib_SObjectSelector
|
public virtual without sharing class fflib_AppBindingsSelector extends fflib_SObjectSelector {
|
||||||
{
|
// Used for mocking
|
||||||
// Used for mocking
|
@TestVisible
|
||||||
@TestVisible
|
private static System.Type SELECTOR_IMPL_TYPE = fflib_AppBindingsSelector.class;
|
||||||
private static System.Type SELECTOR_IMPL_TYPE = fflib_AppBindingsSelector.class;
|
|
||||||
|
|
||||||
public List<Schema.SObjectField> getSObjectFieldList()
|
public List<Schema.SObjectField> getSObjectFieldList() {
|
||||||
{
|
return new List<Schema.SObjectField>{
|
||||||
return new List<Schema.SObjectField>
|
fflib_AppBinding__mdt.Id,
|
||||||
{
|
fflib_AppBinding__mdt.BindingObject__c,
|
||||||
fflib_AppBinding__mdt.Id,
|
fflib_AppBinding__mdt.BindingObjectAlternate__c,
|
||||||
fflib_AppBinding__mdt.BindingObject__c,
|
fflib_AppBinding__mdt.BindingSequence__c,
|
||||||
fflib_AppBinding__mdt.BindingObjectAlternate__c,
|
fflib_AppBinding__mdt.DeveloperName,
|
||||||
fflib_AppBinding__mdt.BindingSequence__c,
|
fflib_AppBinding__mdt.NamespacePrefix,
|
||||||
fflib_AppBinding__mdt.DeveloperName,
|
fflib_AppBinding__mdt.ImplementationType__c,
|
||||||
fflib_AppBinding__mdt.NamespacePrefix,
|
fflib_AppBinding__mdt.InterfaceType__c,
|
||||||
fflib_AppBinding__mdt.ImplementationType__c,
|
fflib_AppBinding__mdt.Type__c
|
||||||
fflib_AppBinding__mdt.InterfaceType__c,
|
};
|
||||||
fflib_AppBinding__mdt.Type__c
|
}
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public static fflib_AppBindingsSelector newInstance()
|
public static fflib_AppBindingsSelector newInstance() {
|
||||||
{
|
return (fflib_AppBindingsSelector) SELECTOR_IMPL_TYPE.newInstance();
|
||||||
return (fflib_AppBindingsSelector) SELECTOR_IMPL_TYPE.newInstance();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public Schema.SObjectType getSObjectType()
|
public Schema.SObjectType getSObjectType() {
|
||||||
{
|
return fflib_AppBinding__mdt.SObjectType;
|
||||||
return fflib_AppBinding__mdt.SObjectType;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public virtual List<fflib_AppBinding__mdt> selectAll()
|
public virtual List<fflib_AppBinding__mdt> selectAll() {
|
||||||
{
|
/**
|
||||||
/**
|
|
||||||
Todo - Waiting to uncomment the following section
|
Todo - Waiting to uncomment the following section
|
||||||
until fflib-apex-common fixes the getFieldPath issue
|
until fflib-apex-common fixes the getFieldPath issue
|
||||||
Currently failing on the BindingObject__r field,
|
Currently failing on the BindingObject__r field,
|
||||||
@@ -79,17 +73,16 @@ public virtual without sharing class fflib_AppBindingsSelector extends fflib_SOb
|
|||||||
.toSOQL());
|
.toSOQL());
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return (List<fflib_AppBinding__mdt>) Database.query(
|
return (List<fflib_AppBinding__mdt>) Database.query(
|
||||||
String.format(
|
String.format(
|
||||||
'SELECT {0} FROM {1}',
|
'SELECT {0} FROM {1} WITH SYSTEM_MODE',
|
||||||
new List<String>
|
new List<String>{
|
||||||
{
|
getFieldListString() +
|
||||||
getFieldListString()
|
', BindingObject__r.QualifiedApiName' +
|
||||||
+ ', BindingObject__r.QualifiedApiName'
|
', ApplicationPackage__r.DeveloperName',
|
||||||
+ ', ApplicationPackage__r.DeveloperName',
|
getSObjectType().getDescribe().getName()
|
||||||
getSObjectType().getDescribe().getName()
|
}
|
||||||
}
|
)
|
||||||
)
|
);
|
||||||
);
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user