Skip to content

Commit

Permalink
Remove unnecessary security check.
Browse files Browse the repository at this point in the history
  • Loading branch information
npsp-reedestockton committed Jan 10, 2024
1 parent d51b683 commit 3caa07e
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions force-app/main/default/classes/GE_GiftEntryController.cls
Original file line number Diff line number Diff line change
Expand Up @@ -426,13 +426,6 @@ public with sharing class GE_GiftEntryController {
DataImport__c dataImportObject = (DataImport__c)JSON.deserialize(dataImport, DataImport__c.class);

try {
// As currently implemented, Gift Entry already checks everything checked in canUpsertDataImport() before
// allowing access. As a result, canUpsertDataImport() should never return false. It is implemented solely
// as a defense against future modifications since it is an AuraEnabled method that could be used outside
// of the currently implemented flow.
if (!canUpsertDataImport(dataImportObject)) {
throw new UTIL_Permissions.InsufficientPermissionException(System.Label.commonAccessErrorMessage);
}
upsert dataImportObject Id;

return dataImportObject;
Expand All @@ -445,23 +438,6 @@ public with sharing class GE_GiftEntryController {
}
}

private static Boolean canUpsertDataImport(DataImport__c dataImportObject) {
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)) {
if (!fieldName.equalsIgnoreCase('Id')) {
return false;
}
}
}

return true;
}

/*******************************************************************************************************
* @description Run the DataImport process on a single gift
* @param dataImport DataImport record to be processed
Expand Down

0 comments on commit 3caa07e

Please sign in to comment.