diff --git a/force-app/main/default/classes/GE_GiftEntryController.cls b/force-app/main/default/classes/GE_GiftEntryController.cls index 7c75f999975..30118bda8ae 100644 --- a/force-app/main/default/classes/GE_GiftEntryController.cls +++ b/force-app/main/default/classes/GE_GiftEntryController.cls @@ -426,18 +426,9 @@ 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; - } catch (UTIL_Permissions.InsufficientPermissionException e) { - throw new AuraHandledException(e.getMessage()); } catch (Exception e) { String JSONExceptionData = ERR_ExceptionData.createExceptionWrapperJSONString(e); @@ -445,23 +436,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 diff --git a/force-app/test/ADDR_Addresses_TEST.cls b/force-app/test/ADDR_Addresses_TEST.cls index b4a46dc426b..33e7d6edae2 100644 --- a/force-app/test/ADDR_Addresses_TEST.cls +++ b/force-app/test/ADDR_Addresses_TEST.cls @@ -809,10 +809,14 @@ public with sharing class ADDR_Addresses_TEST { ); insert contact; - Address__c overrideAddress = [SELECT Undeliverable__c - FROM Address__c - WHERE MailingState__c = 'Pennsylvania']; - + Address__c overrideAddress; + for (Address__c addr : [SELECT Id, MailingState__c, Undeliverable__c FROM Address__c]) { + if (addr.MailingState__c == 'Pennsylvania') { + overrideAddress = addr; + break; + } + } + Test.startTest(); overrideAddress.Undeliverable__c = true; update overrideAddress; @@ -2229,10 +2233,14 @@ public with sharing class ADDR_Addresses_TEST { insert testContact; Test.stopTest(); - Address__c testAddress = [SELECT Latest_Start_Date__c, Default_Address__c - FROM Address__c - WHERE MailingState__c = 'Washington' - LIMIT 1]; + Address__c testAddress; + for (Address__c addr : [SELECT Id, MailingState__c, Latest_Start_Date__c, Default_Address__c FROM Address__c]) { + if (addr.MailingState__c == 'Washington') { + testAddress = addr; + break; + } + } + System.assertEquals(true, testAddress.Default_Address__c, 'Address should be set as the default address.'); System.assertEquals(System.today(), testAddress.Latest_Start_Date__c, 'The default address latest start date ' + 'should be set to today\'s date.'); @@ -2548,7 +2556,6 @@ public with sharing class ADDR_Addresses_TEST { MailingStreet__c, MailingCity__c, MailingState__c, MailingPostalCode__c, MailingCountry__c FROM Address__c - ORDER BY MailingState__c ]; }