Skip to content

Commit

Permalink
Fix access checks
Browse files Browse the repository at this point in the history
  • Loading branch information
npsp-reedestockton committed Nov 10, 2023
1 parent 626ebad commit 917b6a9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions force-app/main/default/classes/GE_GiftEntryController.cls
Original file line number Diff line number Diff line change
Expand Up @@ -446,18 +446,16 @@ public with sharing class GE_GiftEntryController {
}

private static Boolean canUpsertDataImport(DataImport__c dataImportObject) {
if (Test.isRunningTest()) {
return true;
}

if (!UTIL_Permissions.canCreate(UTIL_Namespace.StrAllNSPrefix('DataImport__c'))) {
return false;
}

for (String fieldName : dataImportObject.getPopulatedFieldsAsMap().keySet()) {
if (!UTIL_Permissions.canUpdate(UTIL_Namespace.StrAllNSPrefix('DataImport__c'),
UTIL_Namespace.StrAllNSPrefix(fieldName), false)) {
return false;
if (!fieldName.equalsIgnoreCase('Id')) {
return false;
}
}
}

Expand Down Expand Up @@ -1194,7 +1192,8 @@ public with sharing class GE_GiftEntryController {
Set<String> fieldsToCheck = new Set<String>{
'Name',
'Description__c',
'Template_JSON__c'
'Template_JSON__c',
'Format_Version__c'
};
if (!canUpsertFormTemplate(fieldsToCheck)) {
throw new UTIL_Permissions.InsufficientPermissionException(System.Label.commonAccessErrorMessage);
Expand All @@ -1204,7 +1203,8 @@ public with sharing class GE_GiftEntryController {
Form_Template__c templateObj = new Form_Template__c(Id = id,
Name = name,
Description__c = description,
Template_JSON__c = templateJSON);
Template_JSON__c = templateJSON,
Format_Version__c = formatVersion);
upsert templateObj;
return templateObj.Id;
}
Expand Down

0 comments on commit 917b6a9

Please sign in to comment.