@@ -144,27 +144,20 @@ public function toArray($format = '%s', $hideEmpty = FALSE) {
144
144
*
145
145
* @param int $contact_id
146
146
* ID of a contact to search for.
147
- * @param int $group_id
148
- * ID of a group to search for.
149
- * @param bool $aclRoles
150
- * Should we include ACL Roles.
151
147
*
152
148
* @return array
153
149
* Array of assoc. arrays of ACL rules
154
150
*
155
151
* @throws \CRM_Core_Exception
156
152
*/
157
- public static function getACLs ($ contact_id = NULL , $ group_id = NULL , $ aclRoles = FALSE ) {
153
+ public static function getACLs ($ contact_id = NULL ) {
158
154
$ results = [];
159
155
160
156
if (empty ($ contact_id )) {
161
157
return $ results ;
162
158
}
163
159
164
160
$ contact_id = CRM_Utils_Type::escape ($ contact_id , 'Integer ' );
165
- if ($ group_id ) {
166
- $ group_id = CRM_Utils_Type::escape ($ group_id , 'Integer ' );
167
- }
168
161
169
162
$ rule = new CRM_ACL_BAO_ACL ();
170
163
@@ -176,23 +169,9 @@ public static function getACLs($contact_id = NULL, $group_id = NULL, $aclRoles =
176
169
$ query = " SELECT acl.*
177
170
FROM $ acl acl " ;
178
171
179
- if (!empty ($ group_id )) {
180
- $ query .= " INNER JOIN $ c2g group_contact
181
- ON acl.entity_id = group_contact.group_id
182
- WHERE acl.entity_table = ' $ group'
183
- AND acl.is_active = 1
184
- AND group_contact.group_id = $ group_id " ;
185
-
186
- if (!empty ($ contact_id )) {
187
- $ query .= " AND group_contact.contact_id = $ contact_id
188
- AND group_contact.status = 'Added' " ;
189
- }
190
- }
191
- else {
192
- if (!empty ($ contact_id )) {
193
- $ query .= " WHERE acl.entity_table = ' $ contact'
194
- AND acl.entity_id = $ contact_id " ;
195
- }
172
+ if (!empty ($ contact_id )) {
173
+ $ query .= " WHERE acl.entity_table = ' $ contact'
174
+ AND acl.entity_id = $ contact_id " ;
196
175
}
197
176
198
177
$ rule ->query ($ query );
@@ -201,9 +180,7 @@ public static function getACLs($contact_id = NULL, $group_id = NULL, $aclRoles =
201
180
$ results [$ rule ->id ] = $ rule ->toArray ();
202
181
}
203
182
204
- if ($ aclRoles ) {
205
- $ results += self ::getACLRoles ($ contact_id , $ group_id );
206
- }
183
+ $ results += self ::getACLRoles ($ contact_id );
207
184
208
185
return $ results ;
209
186
}
@@ -411,7 +388,7 @@ public static function getAllByContact($contact_id) {
411
388
$ result = [];
412
389
413
390
/* First, the contact-specific ACLs, including ACL Roles */
414
- $ result += self ::getACLs ($ contact_id, NULL , TRUE );
391
+ $ result += self ::getACLs ($ contact_id );
415
392
416
393
/* Then, all ACLs granted through group membership */
417
394
$ result += self ::getGroupACLs ($ contact_id , TRUE );
0 commit comments