From: eileen Date: Thu, 7 Nov 2019 19:18:38 +0000 (+1300) Subject: Fix cachekey string X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=df671bc512d8ae0a3b08bd3016b95174addbdb3f;p=civicrm-core.git 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. --- 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