From df671bc512d8ae0a3b08bd3016b95174addbdb3f Mon Sep 17 00:00:00 2001 From: eileen Date: Fri, 8 Nov 2019 08:18:38 +1300 Subject: [PATCH] Fix cachekey string I hit a bug (in a unit test) where a user without permissions to access custom data would do a check_permissions api call followed by a check_permissions = 0 call. In the second call custom fields were not returned as they were already excluded from the cached key. --- CRM/Contact/BAO/Contact.php | 1 + 1 file changed, 1 insertion(+) diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index 705be21ebb..132be6ceef 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -1542,6 +1542,7 @@ WHERE civicrm_contact.id = " . CRM_Utils_Type::escape($id, 'Integer'); $cacheKeyString .= $export ? '_1' : '_0'; $cacheKeyString .= $status ? '_1' : '_0'; $cacheKeyString .= $search ? '_1' : '_0'; + $cacheKeyString .= '_' . (bool) $checkPermissions; //CRM-14501 it turns out that the impact of permissioning here is sometimes inconsistent. The field that //calculates custom fields takes into account the logged in user & caches that for all users //as an interim fix we will cache the fields by contact -- 2.25.1