Commit | Line | Data |
---|---|---|
58b85361 MD |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
4 | | Copyright CiviCRM LLC. All rights reserved. | | |
5 | | | | |
6 | | This work is published under the GNU AGPLv3 license with some | | |
7 | | permitted exceptions and without any warranty. For full license | | |
8 | | and copyright information, see https://civicrm.org/licensing | | |
9 | +--------------------------------------------------------------------+ | |
10 | */ | |
11 | ||
12 | /** | |
13 | * | |
14 | * @package CRM | |
15 | * @copyright CiviCRM LLC https://civicrm.org/licensing | |
16 | */ | |
17 | ||
18 | /** | |
19 | * Access Control AclRole. | |
20 | */ | |
21 | class CRM_ACL_BAO_ACLEntityRole extends CRM_ACL_DAO_ACLEntityRole { | |
58b85361 MD |
22 | |
23 | /** | |
24 | * Whitelist of possible values for the entity_table field | |
25 | * | |
26 | * @return array | |
27 | */ | |
28 | public static function entityTables(): array { | |
29a0c5ce MD |
29 | return [ |
30 | 'civicrm_contact' => ts('Contact'), | |
31 | 'civicrm_group' => ts('Group'), | |
32 | ]; | |
58b85361 MD |
33 | } |
34 | ||
35 | /** | |
36 | * @param array $params | |
37 | * | |
38 | * @return CRM_ACL_DAO_EntityRole | |
39 | */ | |
40 | public static function create(&$params) { | |
29a0c5ce | 41 | return self::writeRecord($params); |
58b85361 MD |
42 | } |
43 | ||
44 | /** | |
45 | * @param array $params | |
46 | * @param $defaults | |
47 | */ | |
48 | public static function retrieve(&$params, &$defaults) { | |
29a0c5ce | 49 | CRM_Core_DAO::commonRetrieve(__CLASS__, $params, $defaults); |
58b85361 MD |
50 | } |
51 | ||
52 | /** | |
53 | * Update the is_active flag in the db. | |
54 | * | |
55 | * @param int $id | |
56 | * Id of the database record. | |
57 | * @param bool $is_active | |
58 | * Value we want to set the is_active field. | |
59 | * | |
60 | * @return bool | |
61 | * true if we found and updated the object, else false | |
62 | */ | |
63 | public static function setIsActive($id, $is_active) { | |
29a0c5ce | 64 | return CRM_Core_DAO::setFieldValue(__CLASS__, $id, 'is_active', $is_active); |
58b85361 MD |
65 | } |
66 | ||
67 | /** | |
29a0c5ce | 68 | * Delete Dedupe Entity Role records. |
58b85361 MD |
69 | * |
70 | * @param int $entityRoleId | |
71 | * ID of the EntityRole record to be deleted. | |
67d870c5 | 72 | * @deprecated |
58b85361 MD |
73 | */ |
74 | public static function del($entityRoleId) { | |
67d870c5 | 75 | return self::deleteRecord(['id' => $entityRoleId]); |
58b85361 MD |
76 | } |
77 | ||
78 | } |