From: eileen Date: Tue, 23 Mar 2021 00:29:45 +0000 (+1300) Subject: Return from getACLRoles when contactID is null X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=dabb64f3df9d46279fccee141ec7fb9e99551b66;p=civicrm-core.git Return from getACLRoles when contactID is null I've made this patch the least possible code wise to allow brain space to think about the query.... Basically the where is WHERE acl.entity_table='civicrm_acl_role'.... if contact_id is set it becomes AND acl.entity_table = 'civicrm_contact' Which means that it would only ever return empty results (once this is merged more cleanup can happen but I wanted to make this change easy to think through) --- diff --git a/CRM/ACL/BAO/ACL.php b/CRM/ACL/BAO/ACL.php index 64e5bc6e71..5927b87753 100644 --- a/CRM/ACL/BAO/ACL.php +++ b/CRM/ACL/BAO/ACL.php @@ -122,7 +122,7 @@ class CRM_ACL_BAO_ACL extends CRM_ACL_DAO_ACL { $where = ['acl.entity_table = "civicrm_acl_role" AND acl.entity_id IN (' . implode(',', array_keys(CRM_Core_OptionGroup::values('acl_role'))) . ')']; if (!empty($contact_id)) { - $where[] = " acl.entity_table = 'civicrm_contact' AND acl.is_active = 1 AND acl.entity_id = $contact_id"; + return []; } $results = [];