fflib-apex-common icon indicating copy to clipboard operation
fflib-apex-common copied to clipboard

fflib_SecurityUtils does not use fflib_SObjectDescribe everywhere

Open goto-dev-null opened this issue 4 years ago • 0 comments
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?

goto-dev-null avatar Nov 01 '21 19:11 goto-dev-null