From: deb.monish Date: Fri, 20 May 2016 09:57:00 +0000 (+0530) Subject: additional fixes X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=5605d571af2f013a5b628571bae8d6949e6d72f8;p=civicrm-core.git additional fixes --- diff --git a/CRM/ACL/BAO/ACL.php b/CRM/ACL/BAO/ACL.php index 1033986c5f..205cb0b9ca 100644 --- a/CRM/ACL/BAO/ACL.php +++ b/CRM/ACL/BAO/ACL.php @@ -729,9 +729,14 @@ SELECT count( a.id ) * @return array - the first key is join part of the query and the second key is the where part of the query */ public static function buildAcl($contactId) { + // If there is no $contactId passed return empty ACL join and where clause + if (empty($contactId)) { + return array('', ''); + } + $tables = array(); $whereTables = array(); - $whereClause = CRM_ACL_BAO_ACL::whereClause(CRM_Core_Permission::VIEW, $tables, $whereTables, $contactId); + $whereClause = CRM_ACL_BAO_ACL::whereClause(CRM_Core_Permission::VIEW, $tables, $whereTables, $contactId, TRUE); if (strlen($whereClause)) { $whereClause = " AND (" . $whereClause . ")"; } @@ -761,10 +766,11 @@ SELECT count( a.id ) * @param $tables * @param $whereTables * @param int $contactID + * @param bool $strictReturn If there is no where clause build for ACL * * @return null|string */ - public static function whereClause($type, &$tables, &$whereTables, $contactID = NULL) { + public static function whereClause($type, &$tables, &$whereTables, $contactID = NULL, $strictReturn = FALSE) { $acls = CRM_ACL_BAO_Cache::build($contactID); $whereClause = NULL; @@ -874,7 +880,7 @@ SELECT g.* // call the hook to get additional whereClauses CRM_Utils_Hook::aclWhereClause($type, $tables, $whereTables, $contactID, $whereClause); - if (empty($whereClause)) { + if (empty($whereClause) && !$strictReturn) { $whereClause = ' ( 0 ) '; }