fflib-apex-common
fflib-apex-common copied to clipboard
fflib_SecurityUtils does not use fflib_SObjectDescribe everywhere
trafficstars
I considered just making a PR but this seems intentional. Example:
public static void checkFieldIsReadable(SObjectType objType, String fieldName)
{
checkFieldIsReadable(objType, fflib_SObjectDescribe.getDescribe(objType).getField(fieldName));
}
public static void checkObjectIsReadable(SObjectType objType)
{
if (BYPASS_INTERNAL_FLS_AND_CRUD)
return;
if (!objType.getDescribe().isAccessible())
throw new CrudException(OperationType.READ, objType);
}
Obviously I think using fflib_SObjectDescribe everywhere is the way to go, but if not, it seems concerning if only because checkFieldIsReadable is using a different SObjectDescribe. Otherwise, if it's not the same, it should use the cache.
Unless I'm missing something?