Remove getACLRoles
authoreileen <emcnaughton@wikimedia.org>
Tue, 23 Mar 2021 22:35:04 +0000 (11:35 +1300)
committereileen <emcnaughton@wikimedia.org>
Tue, 23 Mar 2021 22:35:04 +0000 (11:35 +1300)
We have cleaned up the code to clarify that
1) it returns an empty array if contact id is set and
2) it is only called with contact_id is set

Ergo it does nada

Not called from anywhere else (I made it protected last
cleanup round)

CRM/ACL/BAO/ACL.php

index 6f182367093ee344dd6276116950a156bd94d5ea..7c90f24ad808b91c9c15e8fc3686bcb7a636f580 100644 (file)
@@ -72,38 +72,6 @@ class CRM_ACL_BAO_ACL extends CRM_ACL_DAO_ACL {
     return $result;
   }
 
     return $result;
   }
 
-  /**
-   * Get all of the ACLs through ACL groups.
-   *
-   * @param int $contact_id
-   *   ID of a contact to search for.
-   *
-   * @return array
-   *   Array of assoc. arrays of ACL rules
-   *
-   * @throws \CRM_Core_Exception
-   */
-  protected static function getACLRoles($contact_id = NULL) {
-    $contact_id = CRM_Utils_Type::escape($contact_id, 'Integer');
-
-    $query = 'SELECT acl.* FROM civicrm_acl 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)) {
-      return [];
-    }
-
-    $results = [];
-
-    $rule = CRM_Core_DAO::executeQuery($query . ' WHERE ' . implode(' AND ', $where));
-
-    while ($rule->fetch()) {
-      $results[$rule->id] = $rule->toArray();
-    }
-
-    return $results;
-  }
-
   /**
    * Get all ACLs granted to a contact through all group memberships.
    *
   /**
    * Get all ACLs granted to a contact through all group memberships.
    *
@@ -236,8 +204,6 @@ SELECT acl.*
       while ($rule->fetch()) {
         $result[$rule->id] = $rule->toArray();
       }
       while ($rule->fetch()) {
         $result[$rule->id] = $rule->toArray();
       }
-
-      $result += self::getACLRoles($contact_id);
     }
 
     /* Then, all ACLs granted through group membership */
     }
 
     /* Then, all ACLs granted through group membership */