From: eileen Date: Wed, 27 Mar 2013 03:46:24 +0000 (+1300) Subject: CRM-12209 groups not showing when ACL hook in use X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=0f8844a17c569b019dfcfbc6e99ae1d9db8de015;p=civicrm-core.git CRM-12209 groups not showing when ACL hook in use --- diff --git a/CRM/Contact/BAO/Group.php b/CRM/Contact/BAO/Group.php index e21a768224..5fd504daed 100644 --- a/CRM/Contact/BAO/Group.php +++ b/CRM/Contact/BAO/Group.php @@ -782,6 +782,10 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group { while ($object->fetch()) { $permission = CRM_Contact_BAO_Group::checkPermission($object->id, $object->title); + //@todo CRM-12209 introduced an ACL check in the whereClause function + // it may be that this checking is now obsolete - or that what remains + // should be removed to the whereClause (which is also accessed by getCount) + if ($permission) { $newLinks = $links; $values[$object->id] = array(); @@ -1115,6 +1119,15 @@ WHERE {$whereClause}"; if ($excludeHidden) { $clauses[] = 'groups.is_hidden = 0'; } + //CRM-12209 + if (!CRM_Core_Permission::check('view all contacts')) { + //get the allowed groups for the current user + $groups = CRM_ACL_API::group(CRM_ACL_API::VIEW); + if (!empty( $groups)) { + $groupList = implode( ', ', array_values( $groups ) ); + $clauses[] = "groups.id IN ( $groupList ) "; + } + } return implode(' AND ', $clauses); }