Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

233 list out of bounds query factory #251

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions fflib/src/classes/fflib_QueryFactory.cls
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,19 @@ public class fflib_QueryFactory { //No explicit sharing declaration - inherit fr
private Schema.ChildRelationship relationship;
private Map<Schema.ChildRelationship, fflib_QueryFactory> subselectQueryMap;

private String getFieldPath(String fieldName){
private String getFieldPath(String fieldName)
{
if (!enforceFLS)
{
// There is no need to validate FLS for individual fields in the relationship
return fieldName;
}

if(!fieldName.contains('.')){ //single field
Schema.SObjectField token = fflib_SObjectDescribe.getDescribe(table).getField(fieldName.toLowerCase());
if(token == null)
throw new InvalidFieldException(fieldName,this.table);
if (enforceFLS)
fflib_SecurityUtils.checkFieldIsReadable(this.table, token);
fflib_SecurityUtils.checkFieldIsReadable(this.table, token);
return token.getDescribe().getName();
}

Expand All @@ -103,7 +109,7 @@ public class fflib_QueryFactory { //No explicit sharing declaration - inherit fr
Schema.SObjectField token = fflib_SObjectDescribe.getDescribe(lastSObjectType).getField(field.toLowerCase());
DescribeFieldResult tokenDescribe = token != null ? token.getDescribe() : null;

if (token != null && enforceFLS) {
if (token != null) {
fflib_SecurityUtils.checkFieldIsReadable(lastSObjectType, token);
}

Expand Down