From 96454cadb12f760f891ec79c83ee9df22c8102be Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 20 Jan 2016 21:50:34 -0500 Subject: [PATCH] CRM-17645 - Prevent adding case acl clause inappropriately --- CRM/Case/BAO/Query.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CRM/Case/BAO/Query.php b/CRM/Case/BAO/Query.php index 19867be3c0..503d6f0121 100644 --- a/CRM/Case/BAO/Query.php +++ b/CRM/Case/BAO/Query.php @@ -233,9 +233,13 @@ class CRM_Case_BAO_Query { } } // Add acl clause - $aclClauses = array_filter(CRM_Case_BAO_Case::getSelectWhereClause()); - foreach ($aclClauses as $clause) { - $query->_where[0][] = $clause; + // This is new and so far only for cases - it would be good to find a more abstract + // way to auto-apply this for all search components rather than copy-pasting this code to others + if (isset($query->_tables['civicrm_case'])) { + $aclClauses = array_filter(CRM_Case_BAO_Case::getSelectWhereClause()); + foreach ($aclClauses as $clause) { + $query->_where[0][] = $clause; + } } } -- 2.25.1