3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.5 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
31 * @copyright CiviCRM LLC (c) 2004-2014
39 class CRM_ACL_BAO_ACL
extends CRM_ACL_DAO_ACL
{
40 static $_entityTable = NULL;
41 static $_objectTable = NULL;
42 static $_operation = NULL;
44 static $_fieldKeys = NULL;
46 static function entityTable() {
47 if (!self
::$_entityTable) {
48 self
::$_entityTable = array(
49 'civicrm_contact' => ts('Contact'),
50 'civicrm_acl_role' => ts('ACL Role'),
53 return self
::$_entityTable;
56 static function objectTable() {
57 if (!self
::$_objectTable) {
58 self
::$_objectTable = array(
59 'civicrm_contact' => ts('Contact'),
60 'civicrm_group' => ts('Group'),
61 'civicrm_saved_search' => ts('Contact Group'),
62 'civicrm_admin' => ts('Administer'),
63 'civicrm_admin' => ts('Import'),
66 return self
::$_objectTable;
69 static function operation() {
70 if (!self
::$_operation) {
71 self
::$_operation = array(
74 'Create' => ts('Create'),
75 'Delete' => ts('Delete'),
76 'Search' => ts('Search'),
80 return self
::$_operation;
84 * Construct a WHERE clause to handle permissions to $object_*
87 * @param string $operation - The operation being attempted
88 * @param string $object_table - The table of the object in question
89 * @param int $object_id - The ID of the object in question
90 * @param int $acl_id - If it's a grant/revoke operation, the ACL ID
91 * @param boolean $acl_role - For grant operations, this flag determines if we're granting a single acl (false) or an entire group.
93 * @internal param \ref $array $tables - Any tables that may be needed in the FROM
94 * @return string - The WHERE clause, or 0 on failure
98 public static function permissionClause(&$tables, $operation,
99 $object_table = NULL, $object_id = NULL,
100 $acl_id = NULL, $acl_role = FALSE
102 $dao = new CRM_ACL_DAO_ACL
;
105 'ACL' => self
::getTableName(),
106 'ACLRole' => 'civicrm_acl_role',
107 'ACLEntityRole' => CRM_ACL_DAO_EntityRole
::getTableName(),
108 'Contact' => CRM_Contact_DAO_Contact
::getTableName(),
109 'Group' => CRM_Contact_DAO_Group
::getTableName(),
110 'GroupContact' => CRM_Contact_DAO_GroupContact
::getTableName(),
113 $session = CRM_Core_Session
::singleton();
114 $contact_id = $session->get('userID');
116 $where = " {$t['ACL']}.operation = '" . CRM_Utils_Type
::escape($operation, 'String') . "'";
118 /* Include clause if we're looking for a specific table/id permission */
121 if (!empty($object_table)) {
122 $where .= " AND ( {$t['ACL']}.object_table IS null
123 OR ({$t['ACL']}.object_table = '" . CRM_Utils_Type
::escape($object_table, 'String') . "'";
124 if (!empty($object_id)) {
125 $where .= " AND ({$t['ACL']}.object_id IS null
126 OR {$t['ACL']}.object_id = " . CRM_Utils_Type
::escape($object_id, 'Integer') . ')';
131 /* Include clause if we're granting an ACL or ACL Role */
134 if (!empty($acl_id)) {
135 $where .= " AND ({$t['ACL']}.acl_id IS null
136 OR {$t['ACL']}.acl_id = " . CRM_Utils_Type
::escape($acl_id, 'Integer') . ')';
138 $where .= " AND {$t['ACL']}.acl_table = '{$t['ACLRole']}'";
141 $where .= " AND {$t['ACL']}.acl_table = '{$t['ACL']}'";
147 /* Query for permissions granted to all contacts in the domain */
150 $query[] = "SELECT {$t['ACL']}.*, 0 as override
153 WHERE {$t['ACL']}.entity_table = '{$t['Domain']}'
156 /* Query for permissions granted to all contacts through an ACL group */
159 $query[] = "SELECT {$t['ACL']}.*, 0 as override
162 INNER JOIN {$t['ACLEntityRole']}
163 ON ({$t['ACL']}.entity_table = '{$t['ACLRole']}'
164 AND {$t['ACL']}.entity_id =
165 {$t['ACLEntityRole']}.acl_role_id)
167 INNER JOIN {$t['ACLRole']}
168 ON {$t['ACL']}.entity_id =
171 WHERE {$t['ACLEntityRole']}.entity_table =
173 AND {$t['ACLRole']}.is_active = 1
176 /* Query for permissions granted directly to the contact */
179 $query[] = "SELECT {$t['ACL']}.*, 1 as override
182 INNER JOIN {$t['Contact']}
183 ON ({$t['ACL']}.entity_table = '{$t['Contact']}'
184 AND {$t['ACL']}.entity_id = {$t['Contact']}.id)
186 WHERE {$t['Contact']}.id = $contact_id
189 /* Query for permissions granted to the contact through an ACL group */
192 $query[] = "SELECT {$t['ACL']}.*, 1 as override
195 INNER JOIN {$t['ACLEntityRole']}
196 ON ({$t['ACL']}.entity_table = '{$t['ACLRole']}'
197 AND {$t['ACL']}.entity_id =
198 {$t['ACLEntityRole']}.acl_role_id)
200 INNER JOIN {$t['ACLRole']}
201 ON {$t['ACL']}.entity_id = {$t['ACLRole']}.id
203 WHERE {$t['ACLEntityRole']}.entity_table =
205 AND {$t['ACLRole']}.is_active = 1
206 AND {$t['ACLEntityRole']}.entity_id = $contact_id
209 /* Query for permissions granted to the contact through a group */
212 $query[] = "SELECT {$t['ACL']}.*, 0 as override
215 INNER JOIN {$t['GroupContact']}
216 ON ({$t['ACL']}.entity_table = '{$t['Group']}'
217 AND {$t['ACL']}.entity_id =
218 {$t['GroupContact']}.group_id)
221 AND {$t['GroupContact']}.contact_id = $contact_id
222 AND {$t['GroupContact']}.status = 'Added')";
225 /* Query for permissions granted through an ACL group to a Contact
229 $query[] = "SELECT {$t['ACL']}.*, 0 as override
232 INNER JOIN {$t['ACLEntityRole']}
233 ON ({$t['ACL']}.entity_table = '{$t['ACLRole']}'
234 AND {$t['ACL']}.entity_id =
235 {$t['ACLEntityRole']}.acl_role_id)
237 INNER JOIN {$t['ACLRole']}
238 ON {$t['ACL']}.entity_id = {$t['ACLRole']}.id
240 INNER JOIN {$t['GroupContact']}
241 ON ({$t['ACLEntityRole']}.entity_table =
243 AND {$t['ACLEntityRole']}.entity_id =
244 {$t['GroupContact']}.group_id)
247 AND {$t['ACLRole']}.is_active = 1
248 AND {$t['GroupContact']}.contact_id = $contact_id
249 AND {$t['GroupContact']}.status = 'Added'";
251 $union = '(' . implode(') UNION DISTINCT (', $query) . ')';
259 while ($dao->fetch()) {
260 /* Instant bypass for the following cases:
261 * 1) the rule governs all tables
262 * 2) the rule governs all objects in the table in question
263 * 3) the rule governs the specific object we want
267 if (empty($dao->object_table
) ||
268 ($dao->object_table
== $object_table
269 && (empty($dao->object_id
)
270 ||
$dao->object_id
== $object_id
277 /* Otherwise try to generate a clause for this rule */
280 $clause = self
::getClause(
281 $dao->object_table
, $dao->object_id
, $tables
284 /* If the clause returned is null, then the rule is a blanket
285 * (id is null) on a table other than the one we're interested
289 if (empty($clause)) {
294 /* Now we figure out if this is an allow or deny rule, and possibly
295 * a contact-level override */
304 if ($dao->override
) {
305 $override[] = $clause;
310 $allows = '(' . implode(' OR ', $allow) . ')';
311 $denies = '(' . implode(' OR ', $deny) . ')';
312 if (!empty($override)) {
313 $denies = '(NOT (' . implode(' OR ', $override) . ") AND $denies)";
316 return "($allows AND NOT $denies)";
320 * Given a table and id pair, return the filter clause
322 * @param string $table - The table owning the object
323 * @param int $id - The ID of the object
326 * @internal param \ref $array $tables - Tables that will be needed in the FROM
328 * @return string|null - WHERE-style clause to filter results,
329 * or null if $table or $id is null
333 public static function getClause($table, $id, &$tables) {
334 $table = CRM_Utils_Type
::escape($table, 'String');
335 $id = CRM_Utils_Type
::escape($id, 'Integer');
336 $whereTables = array();
338 $ssTable = CRM_Contact_BAO_SavedSearch
::getTableName();
343 elseif ($table == $ssTable) {
344 return CRM_Contact_BAO_SavedSearch
::whereClause($id, $tables, $whereTables);
346 elseif (!empty($id)) {
347 $tables[$table] = TRUE;
348 return "$table.id = $id";
354 * Construct an associative array of an ACL rule's properties
356 * @param string sprintf format for array
357 * @param bool empty only return elemnts that have a value set.
359 * @return array - Assoc. array of the ACL rule's properties
362 function toArray($format = '%s', $hideEmpty = false) {
365 if (!self
::$_fieldKeys) {
366 $fields = CRM_ACL_DAO_ACL
::fields();
367 self
::$_fieldKeys = array_keys($fields);
370 foreach (self
::$_fieldKeys as $field) {
371 $result[$field] = $this->$field;
377 * Retrieve ACLs for a contact or group. Note that including a contact id
378 * without a group id will return those ACL rules which are granted
379 * directly to the contact, but not those granted to the contact through
380 * any/all of his group memberships.
382 * @param int $contact_id - ID of a contact to search for
383 * @param int $group_id - ID of a group to search for
384 * @param boolean $aclRoles - Should we include ACL Roles
386 * @return array - Array of assoc. arrays of ACL rules
390 public static function &getACLs($contact_id = NULL, $group_id = NULL, $aclRoles = FALSE) {
393 if (empty($contact_id)) {
397 $contact_id = CRM_Utils_Type
::escape($contact_id, 'Integer');
399 $group_id = CRM_Utils_Type
::escape($group_id, 'Integer');
402 $rule = new CRM_ACL_BAO_ACL();
405 $acl = self
::getTableName();
406 $contact = CRM_Contact_BAO_Contact
::getTableName();
407 $c2g = CRM_Contact_BAO_GroupContact
::getTableName();
408 $group = CRM_Contact_BAO_Group
::getTableName();
410 $query = " SELECT $acl.*
413 if (!empty($group_id)) {
414 $query .= " INNER JOIN $c2g
415 ON $acl.entity_id = $c2g.group_id
416 WHERE $acl.entity_table = '$group'
417 AND $acl.is_active = 1
418 AND $c2g.group_id = $group_id";
420 if (!empty($contact_id)) {
421 $query .= " AND $c2g.contact_id = $contact_id
422 AND $c2g.status = 'Added'";
426 if (!empty($contact_id)) {
427 $query .= " WHERE $acl.entity_table = '$contact'
428 AND $acl.entity_id = $contact_id";
432 $rule->query($query);
434 while ($rule->fetch()) {
435 $results[$rule->id
] = $rule->toArray();
439 $results +
= self
::getACLRoles($contact_id, $group_id);
446 * Get all of the ACLs through ACL groups
448 * @param int $contact_id - ID of a contact to search for
449 * @param int $group_id - ID of a group to search for
451 * @return array - Array of assoc. arrays of ACL rules
455 public static function &getACLRoles($contact_id = NULL, $group_id = NULL) {
456 $contact_id = CRM_Utils_Type
::escape($contact_id, 'Integer');
458 $group_id = CRM_Utils_Type
::escape($group_id, 'Integer');
461 $rule = new CRM_ACL_BAO_ACL();
463 $acl = self
::getTableName();
464 $aclRole = 'civicrm_acl_role';
465 $aclRoleJoin = CRM_ACL_DAO_EntityRole
::getTableName();
466 $contact = CRM_Contact_BAO_Contact
::getTableName();
467 $c2g = CRM_Contact_BAO_GroupContact
::getTableName();
468 $group = CRM_Contact_BAO_Group
::getTableName();
470 $query = " SELECT $acl.*
472 INNER JOIN civicrm_option_group og
473 ON og.name = 'acl_role'
474 INNER JOIN civicrm_option_value ov
475 ON $acl.entity_table = '$aclRole'
476 AND ov.option_group_id = og.id
477 AND $acl.entity_id = ov.value";
479 if (!empty($group_id)) {
480 $query .= " INNER JOIN $c2g
481 ON $acl.entity_id = $c2g.group_id
482 WHERE $acl.entity_table = '$group'
483 AND $acl.is_active = 1
484 AND $c2g.group_id = $group_id";
486 if (!empty($contact_id)) {
487 $query .= " AND $c2g.contact_id = $contact_id
488 AND $c2g.status = 'Added'";
492 if (!empty($contact_id)) {
493 $query .= " WHERE $acl.entity_table = '$contact'
494 AND $acl.is_active = 1
495 AND $acl.entity_id = $contact_id";
501 $rule->query($query);
503 while ($rule->fetch()) {
504 $results[$rule->id
] = $rule->toArray();
511 * Get all ACLs granted to a contact through all group memberships
513 * @param int $contact_id - The contact's ID
514 * @param boolean $aclRoles - Include ACL Roles?
516 * @return array - Assoc array of ACL rules
520 public static function &getGroupACLs($contact_id, $aclRoles = FALSE) {
521 $contact_id = CRM_Utils_Type
::escape($contact_id, 'Integer');
523 $rule = new CRM_ACL_BAO_ACL();
526 $acl = self
::getTableName();
527 $c2g = CRM_Contact_BAO_GroupContact
::getTableName();
528 $group = CRM_Contact_BAO_Group
::getTableName();
536 ON $acl.entity_id = $c2g.group_id
537 WHERE $acl.entity_table = '$group'
538 AND $c2g.contact_id = $contact_id
539 AND $c2g.status = 'Added'";
541 $rule->query($query);
543 while ($rule->fetch()) {
544 $results[$rule->id
] = $rule->toArray();
549 $results +
= self
::getGroupACLRoles($contact_id);
556 * Get all of the ACLs for a contact through ACL groups owned by Contact
559 * @param int $contact_id - ID of a contact to search for
561 * @return array - Array of assoc. arrays of ACL rules
565 public static function &getGroupACLRoles($contact_id) {
566 $contact_id = CRM_Utils_Type
::escape($contact_id, 'Integer');
568 $rule = new CRM_ACL_BAO_ACL();
570 $acl = self
::getTableName();
571 $aclRole = 'civicrm_acl_role';
574 $aclER = CRM_ACL_DAO_EntityRole
::getTableName();
575 $c2g = CRM_Contact_BAO_GroupContact
::getTableName();
576 $group = CRM_Contact_BAO_Group
::getTableName();
578 $query = " SELECT $acl.*
580 INNER JOIN civicrm_option_group og
581 ON og.name = 'acl_role'
582 INNER JOIN civicrm_option_value ov
583 ON $acl.entity_table = '$aclRole'
584 AND ov.option_group_id = og.id
585 AND $acl.entity_id = ov.value
588 ON $aclER.acl_role_id = $acl.entity_id
589 AND $aclER.is_active = 1
591 ON $aclER.entity_id = $c2g.group_id
592 AND $aclER.entity_table = 'civicrm_group'
593 WHERE $acl.entity_table = '$aclRole'
594 AND $acl.is_active = 1
595 AND $c2g.contact_id = $contact_id
596 AND $c2g.status = 'Added'";
600 $rule->query($query);
602 while ($rule->fetch()) {
603 $results[$rule->id
] = $rule->toArray();
606 // also get all acls for "Any Role" case
607 // and authenticated User Role if present
609 $session = CRM_Core_Session
::singleton();
610 if ($session->get('ufID') > 0) {
617 WHERE $acl.entity_id IN ( $roles )
618 AND $acl.entity_table = 'civicrm_acl_role'
621 $rule->query($query);
622 while ($rule->fetch()) {
623 $results[$rule->id
] = $rule->toArray();
630 * Get all ACLs owned by a given contact, including domain and group-level.
632 * @param int $contact_id - The contact ID
634 * @return array - Assoc array of ACL rules
638 public static function &getAllByContact($contact_id) {
641 /* First, the contact-specific ACLs, including ACL Roles */
642 $result +
= self
::getACLs($contact_id, NULL, TRUE);
644 /* Then, all ACLs granted through group membership */
645 $result +
= self
::getGroupACLs($contact_id, TRUE);
650 static function create(&$params) {
651 $dao = new CRM_ACL_DAO_ACL();
652 $dao->copyValues($params);
657 static function retrieve(&$params, &$defaults) {
658 CRM_Core_DAO
::commonRetrieve('CRM_ACL_DAO_ACL', $params, $defaults);
662 * update the is_active flag in the db
664 * @param int $id id of the database record
665 * @param boolean $is_active value we want to set the is_active field
667 * @return Object DAO object on sucess, null otherwise
670 static function setIsActive($id, $is_active) {
671 // note this also resets any ACL cache
672 CRM_Core_BAO_Cache
::deleteGroup('contact fields');
674 return CRM_Core_DAO
::setFieldValue('CRM_ACL_DAO_ACL', $id, 'is_active', $is_active);
677 static function check($str, $contactID) {
679 $acls = CRM_ACL_BAO_Cache
::build($contactID);
681 $aclKeys = array_keys($acls);
682 $aclKeys = implode(',', $aclKeys);
684 if (empty($aclKeys)) {
691 FROM civicrm_acl_cache c, civicrm_acl a
692 WHERE c.acl_id = a.id
694 AND a.object_table = %1
695 AND a.id IN ( $aclKeys )
697 $params = array(1 => array($str, 'String'));
699 $count = CRM_Core_DAO
::singleValueQuery($query, $params);
700 return ($count) ?
TRUE : FALSE;
703 public static function whereClause($type, &$tables, &$whereTables, $contactID = NULL) {
704 $acls = CRM_ACL_BAO_Cache
::build($contactID);
705 //CRM_Core_Error::debug( "a: $contactID", $acls );
711 $aclKeys = array_keys($acls);
712 $aclKeys = implode(',', $aclKeys);
715 SELECT a.operation, a.object_id
716 FROM civicrm_acl_cache c, civicrm_acl a
717 WHERE c.acl_id = a.id
719 AND a.object_table = 'civicrm_saved_search'
720 AND a.id IN ( $aclKeys )
724 $dao = CRM_Core_DAO
::executeQuery($query);
726 // do an or of all the where clauses u see
728 while ($dao->fetch()) {
729 // make sure operation matches the type TODO
730 if (self
::matchType($type, $dao->operation
)) {
731 if (!$dao->object_id
) {
733 $whereClause = ' ( 1 ) ';
736 $ids[] = $dao->object_id
;
741 $ids = implode(',', $ids);
745 WHERE g.id IN ( $ids )
748 $dao = CRM_Core_DAO
::executeQuery($query);
749 $staticGroupIDs = array();
750 $cachedGroupIDs = array();
751 while ($dao->fetch()) {
752 // currently operation is restrcited to VIEW/EDIT
753 if ($dao->where_clause
) {
754 if ($dao->select_tables
) {
755 $tmpTables = array();
756 foreach (unserialize($dao->select_tables
) as $tmpName => $tmpInfo) {
757 if ($tmpName == '`civicrm_group_contact-' . $dao->id
. '`') {
758 $tmpName = '`civicrm_group_contact-ACL`';
759 $tmpInfo = str_replace('civicrm_group_contact-' . $dao->id
, 'civicrm_group_contact-ACL', $tmpInfo);
761 elseif ($tmpName == '`civicrm_group_contact_cache_' . $dao->id
. '`') {
762 $tmpName = '`civicrm_group_contact_cache-ACL`';
763 $tmpInfo = str_replace('civicrm_group_contact_cache_' . $dao->id
, 'civicrm_group_contact_cache-ACL', $tmpInfo);
765 $tmpTables[$tmpName] = $tmpInfo;
767 $tables = array_merge($tables,
771 if ($dao->where_tables
) {
772 $tmpTables = array();
773 foreach (unserialize($dao->where_tables
) as $tmpName => $tmpInfo) {
774 if ($tmpName == '`civicrm_group_contact-' . $dao->id
. '`') {
775 $tmpName = '`civicrm_group_contact-ACL`';
776 $tmpInfo = str_replace('civicrm_group_contact-' . $dao->id
, 'civicrm_group_contact-ACL', $tmpInfo);
777 $staticGroupIDs[] = $dao->id
;
779 elseif ($tmpName == '`civicrm_group_contact_cache_' . $dao->id
. '`') {
780 $tmpName = '`civicrm_group_contact_cache-ACL`';
781 $tmpInfo = str_replace('civicrm_group_contact_cache_' . $dao->id
, 'civicrm_group_contact_cache-ACL', $tmpInfo);
782 $cachedGroupIDs[] = $dao->id
;
784 $tmpTables[$tmpName] = $tmpInfo;
786 $whereTables = array_merge($whereTables, $tmpTables);
790 if (($dao->saved_search_id ||
$dao->children ||
$dao->parents
) &&
791 $dao->cache_date
== NULL) {
792 CRM_Contact_BAO_GroupContactCache
::load($dao);
796 if ($staticGroupIDs) {
797 $clauses[] = '( `civicrm_group_contact-ACL`.group_id IN (' . join(', ', $staticGroupIDs) . ') AND `civicrm_group_contact-ACL`.status IN ("Added") )';
800 if ($cachedGroupIDs) {
801 $clauses[] = '`civicrm_group_contact_cache-ACL`.group_id IN (' . join(', ', $cachedGroupIDs) . ')';
806 if (!empty($clauses)) {
807 $whereClause = ' ( ' . implode(' OR ', $clauses) . ' ) ';
810 // call the hook to get additional whereClauses
811 CRM_Utils_Hook
::aclWhereClause($type, $tables, $whereTables, $contactID, $whereClause);
813 if (empty($whereClause)) {
814 $whereClause = ' ( 0 ) ';
820 public static function group($type,
822 $tableName = 'civicrm_saved_search',
824 $includedGroups = NULL
827 $acls = CRM_ACL_BAO_Cache
::build($contactID);
831 $aclKeys = array_keys($acls);
832 $aclKeys = implode(',', $aclKeys);
834 $cacheKey = "$tableName-$aclKeys";
835 $cache = CRM_Utils_Cache
::singleton();
836 $ids = $cache->get($cacheKey);
839 SELECT a.operation, a.object_id
840 FROM civicrm_acl_cache c, civicrm_acl a
841 WHERE c.acl_id = a.id
843 AND a.object_table = %1
844 AND a.id IN ( $aclKeys )
845 GROUP BY a.operation,a.object_id
848 $params = array(1 => array($tableName, 'String'));
849 $dao = CRM_Core_DAO
::executeQuery($query, $params);
850 while ($dao->fetch()) {
851 if ($dao->object_id
) {
852 if (self
::matchType($type, $dao->operation
)) {
853 $ids[] = $dao->object_id
;
857 // this user has got the permission for all objects of this type
858 // check if the type matches
859 if (self
::matchType($type, $dao->operation
)) {
860 foreach ($allGroups as $id => $dontCare) {
867 $cache->set($cacheKey, $ids);
871 if (empty($ids) && !empty($includedGroups) &&
872 is_array($includedGroups)
874 $ids = $includedGroups;
877 CRM_Utils_Hook
::aclGroup($type, $contactID, $tableName, $allGroups, $ids);
882 static function matchType($type, $operation) {
884 switch ($operation) {
890 if ($type == CRM_ACL_API
::VIEW
) {
896 if ($type == CRM_ACL_API
::VIEW ||
$type == CRM_ACL_API
::EDIT
) {
902 if ($type == CRM_ACL_API
::CREATE
) {
908 if ($type == CRM_ACL_API
::DELETE
) {
914 if ($type == CRM_ACL_API
::SEARCH
) {
923 * Function to delete ACL records
925 * @param int $aclId ID of the ACL record to be deleted.
930 static function del($aclId) {
931 // delete all entries from the acl cache
932 CRM_ACL_BAO_Cache
::resetCache();
934 $acl = new CRM_ACL_DAO_ACL();