From a92e785696d8779762842fef3fdd92cc564596d1 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Sat, 26 Oct 2019 10:30:23 +1100 Subject: [PATCH] [REF] Remove usage of CRM_ACL_BAO_Cache::deleteEntry in favour of using functions that just delete from the ACL caches --- CRM/ACL/BAO/Cache.php | 9 +++++++++ CRM/Contact/Import/Form/Preview.php | 6 +++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CRM/ACL/BAO/Cache.php b/CRM/ACL/BAO/Cache.php index 5ea2c6e069..9e68e38bf0 100644 --- a/CRM/ACL/BAO/Cache.php +++ b/CRM/ACL/BAO/Cache.php @@ -181,4 +181,13 @@ WHERE modified_date IS NULL } } + /** + * Remove Entries from `civicrm_acl_contact_cache` for a specific ACLed user + * @param int $userID - contact_id of the ACLed user + * + */ + public static function deleteContactCacheEntry($userID) { + CRM_Core_DAO::executeQuery("DELETE FROM civicrm_acl_contact_cache WHERE user_id = %1", [1 => [$userID, 'Positive']]); + } + } diff --git a/CRM/Contact/Import/Form/Preview.php b/CRM/Contact/Import/Form/Preview.php index e47a5a1047..8de842bd62 100644 --- a/CRM/Contact/Import/Form/Preview.php +++ b/CRM/Contact/Import/Form/Preview.php @@ -287,9 +287,9 @@ class CRM_Contact_Import_Form_Preview extends CRM_Import_Form_Preview { // If ACL applies to the current user, update cache before running the import. if (!CRM_Core_Permission::check('view all contacts')) { - $session = CRM_Core_Session::singleton(); - $userID = $session->get('userID'); - CRM_ACL_BAO_Cache::updateEntry($userID); + $userID = CRM_Core_Session::getLoggedInContactID(); + CRM_ACL_BAO_Cache::deleteEntry($userID); + CRM_ACL_BAO_Cache::deleteContactCacheEntry($userID); } CRM_Utils_Address_USPS::disable($this->_disableUSPS); -- 2.25.1