Merge pull request #20505 from JMAConsulting/contribution_product_api4
[civicrm-core.git] / CRM / ACL / DAO / ACL.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/ACL/ACL.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
2562d09a 9 * (GenCodeChecksum:709746b9e63da79d9ee75de3a0687db4)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the ACL entity.
f41f0342 14 */
e501603b 15class CRM_ACL_DAO_ACL extends CRM_Core_DAO {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '1.6';
c3fc2621 18
e501603b 19 /**
f41f0342 20 * Static instance to hold the table name.
e501603b
TO
21 *
22 * @var string
23 */
fa45b5b9 24 public static $_tableName = 'civicrm_acl';
c3fc2621 25
e501603b 26 /**
f41f0342 27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 28 *
c3fc2621 29 * @var bool
e501603b 30 */
fa45b5b9 31 public static $_log = FALSE;
c3fc2621 32
e501603b
TO
33 /**
34 * Unique table ID
35 *
a296e35e 36 * @var int
e501603b
TO
37 */
38 public $id;
c3fc2621 39
e501603b
TO
40 /**
41 * ACL Name.
42 *
43 * @var string
44 */
45 public $name;
c3fc2621 46
e501603b
TO
47 /**
48 * Is this ACL entry Allow (0) or Deny (1) ?
49 *
a296e35e 50 * @var bool
e501603b
TO
51 */
52 public $deny;
c3fc2621 53
e501603b
TO
54 /**
55 * Table of the object possessing this ACL entry (Contact, Group, or ACL Group)
56 *
57 * @var string
58 */
59 public $entity_table;
c3fc2621 60
e501603b
TO
61 /**
62 * ID of the object possessing this ACL
63 *
e6ca0a57 64 * @var int
e501603b
TO
65 */
66 public $entity_id;
c3fc2621 67
e501603b
TO
68 /**
69 * What operation does this ACL entry control?
70 *
71 * @var string
72 */
73 public $operation;
c3fc2621 74
e501603b
TO
75 /**
76 * The table of the object controlled by this ACL entry
77 *
78 * @var string
79 */
80 public $object_table;
c3fc2621 81
e501603b
TO
82 /**
83 * The ID of the object controlled by this ACL entry
84 *
e6ca0a57 85 * @var int
e501603b
TO
86 */
87 public $object_id;
c3fc2621 88
e501603b
TO
89 /**
90 * If this is a grant/revoke entry, what table are we granting?
91 *
92 * @var string
93 */
94 public $acl_table;
c3fc2621 95
e501603b
TO
96 /**
97 * ID of the ACL or ACL group being granted/revoked
98 *
e6ca0a57 99 * @var int
e501603b
TO
100 */
101 public $acl_id;
c3fc2621 102
e501603b
TO
103 /**
104 * Is this property active?
105 *
e6ca0a57 106 * @var bool
e501603b
TO
107 */
108 public $is_active;
c3fc2621 109
e501603b 110 /**
f41f0342 111 * Class constructor.
e501603b 112 */
c3fc2621 113 public function __construct() {
e501603b
TO
114 $this->__table = 'civicrm_acl';
115 parent::__construct();
116 }
c3fc2621 117
449c4e6b
CW
118 /**
119 * Returns localized title of this entity.
7b66c3b5
AH
120 *
121 * @param bool $plural
122 * Whether to return the plural version of the title.
449c4e6b 123 */
7b66c3b5
AH
124 public static function getEntityTitle($plural = FALSE) {
125 return $plural ? ts('ACLs') : ts('ACL');
449c4e6b
CW
126 }
127
e501603b 128 /**
f41f0342 129 * Returns foreign keys and entity references.
e501603b
TO
130 *
131 * @return array
132 * [CRM_Core_Reference_Interface]
133 */
c3fc2621 134 public static function getReferenceColumns() {
346aaaba 135 if (!isset(Civi::$statics[__CLASS__]['links'])) {
cf0d1c08 136 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621 137 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
346aaaba 138 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 139 }
346aaaba 140 return Civi::$statics[__CLASS__]['links'];
e501603b 141 }
c3fc2621 142
e501603b
TO
143 /**
144 * Returns all the column names of this table
145 *
146 * @return array
147 */
c3fc2621 148 public static function &fields() {
346aaaba 149 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
150 Civi::$statics[__CLASS__]['fields'] = [
151 'id' => [
e501603b
TO
152 'name' => 'id',
153 'type' => CRM_Utils_Type::T_INT,
c3fc2621 154 'title' => ts('ACL ID'),
215b423e 155 'description' => ts('Unique table ID'),
c3fc2621 156 'required' => TRUE,
a36434b9 157 'where' => 'civicrm_acl.id',
522a26c9 158 'table_name' => 'civicrm_acl',
159 'entity' => 'ACL',
160 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 161 'localizable' => 0,
2cbbebe8
A
162 'html' => [
163 'type' => 'Number',
164 ],
1fe423d6 165 'readonly' => TRUE,
a9d0587b 166 'add' => '1.6',
c3fc2621
CW
167 ],
168 'name' => [
e501603b
TO
169 'name' => 'name',
170 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 171 'title' => ts('ACL Name'),
215b423e 172 'description' => ts('ACL Name.'),
e501603b
TO
173 'maxlength' => 64,
174 'size' => CRM_Utils_Type::BIG,
a36434b9 175 'where' => 'civicrm_acl.name',
522a26c9 176 'table_name' => 'civicrm_acl',
177 'entity' => 'ACL',
178 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 179 'localizable' => 0,
c3fc2621 180 'html' => [
e501603b 181 'type' => 'Text',
c3fc2621 182 ],
a9d0587b 183 'add' => '1.6',
c3fc2621
CW
184 ],
185 'deny' => [
e501603b
TO
186 'name' => 'deny',
187 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 188 'title' => ts('Deny ACL?'),
215b423e 189 'description' => ts('Is this ACL entry Allow (0) or Deny (1) ?'),
c3fc2621 190 'required' => TRUE,
a36434b9 191 'where' => 'civicrm_acl.deny',
45a83e42 192 'default' => '0',
522a26c9 193 'table_name' => 'civicrm_acl',
194 'entity' => 'ACL',
195 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 196 'localizable' => 0,
c3fc2621 197 'html' => [
e501603b 198 'type' => 'Radio',
c3fc2621 199 ],
a9d0587b 200 'add' => '1.6',
c3fc2621
CW
201 ],
202 'entity_table' => [
e501603b
TO
203 'name' => 'entity_table',
204 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 205 'title' => ts('ACL Entity'),
215b423e 206 'description' => ts('Table of the object possessing this ACL entry (Contact, Group, or ACL Group)'),
c3fc2621 207 'required' => TRUE,
e501603b
TO
208 'maxlength' => 64,
209 'size' => CRM_Utils_Type::BIG,
a36434b9 210 'where' => 'civicrm_acl.entity_table',
522a26c9 211 'table_name' => 'civicrm_acl',
212 'entity' => 'ACL',
213 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 214 'localizable' => 0,
a9d0587b 215 'add' => '1.6',
c3fc2621
CW
216 ],
217 'entity_id' => [
e501603b
TO
218 'name' => 'entity_id',
219 'type' => CRM_Utils_Type::T_INT,
c3fc2621 220 'title' => ts('Entity ID'),
215b423e 221 'description' => ts('ID of the object possessing this ACL'),
a36434b9 222 'where' => 'civicrm_acl.entity_id',
522a26c9 223 'table_name' => 'civicrm_acl',
224 'entity' => 'ACL',
225 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 226 'localizable' => 0,
a9d0587b 227 'add' => '1.6',
c3fc2621
CW
228 ],
229 'operation' => [
e501603b
TO
230 'name' => 'operation',
231 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 232 'title' => ts('ACL Operation'),
215b423e 233 'description' => ts('What operation does this ACL entry control?'),
c3fc2621 234 'required' => TRUE,
e501603b
TO
235 'maxlength' => 8,
236 'size' => CRM_Utils_Type::EIGHT,
a36434b9 237 'where' => 'civicrm_acl.operation',
522a26c9 238 'table_name' => 'civicrm_acl',
239 'entity' => 'ACL',
240 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 241 'localizable' => 0,
c3fc2621 242 'html' => [
e501603b 243 'type' => 'Select',
c3fc2621
CW
244 ],
245 'pseudoconstant' => [
e501603b 246 'callback' => 'CRM_ACL_BAO_ACL::operation',
800d9240 247 ],
a9d0587b 248 'add' => '1.6',
c3fc2621
CW
249 ],
250 'object_table' => [
e501603b
TO
251 'name' => 'object_table',
252 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 253 'title' => ts('ACL Object'),
215b423e 254 'description' => ts('The table of the object controlled by this ACL entry'),
e501603b
TO
255 'maxlength' => 64,
256 'size' => CRM_Utils_Type::BIG,
a36434b9 257 'where' => 'civicrm_acl.object_table',
522a26c9 258 'table_name' => 'civicrm_acl',
259 'entity' => 'ACL',
260 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 261 'localizable' => 0,
a9d0587b 262 'add' => '1.6',
c3fc2621
CW
263 ],
264 'object_id' => [
e501603b
TO
265 'name' => 'object_id',
266 'type' => CRM_Utils_Type::T_INT,
c3fc2621 267 'title' => ts('ACL Object ID'),
215b423e 268 'description' => ts('The ID of the object controlled by this ACL entry'),
a36434b9 269 'where' => 'civicrm_acl.object_id',
522a26c9 270 'table_name' => 'civicrm_acl',
271 'entity' => 'ACL',
272 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 273 'localizable' => 0,
a9d0587b 274 'add' => '1.6',
c3fc2621
CW
275 ],
276 'acl_table' => [
e501603b
TO
277 'name' => 'acl_table',
278 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 279 'title' => ts('ACL Table'),
215b423e 280 'description' => ts('If this is a grant/revoke entry, what table are we granting?'),
e501603b
TO
281 'maxlength' => 64,
282 'size' => CRM_Utils_Type::BIG,
a36434b9 283 'where' => 'civicrm_acl.acl_table',
522a26c9 284 'table_name' => 'civicrm_acl',
285 'entity' => 'ACL',
286 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 287 'localizable' => 0,
a9d0587b 288 'add' => '1.6',
c3fc2621
CW
289 ],
290 'acl_id' => [
e501603b
TO
291 'name' => 'acl_id',
292 'type' => CRM_Utils_Type::T_INT,
c3fc2621 293 'title' => ts('ACL Group ID'),
215b423e 294 'description' => ts('ID of the ACL or ACL group being granted/revoked'),
a36434b9 295 'where' => 'civicrm_acl.acl_id',
522a26c9 296 'table_name' => 'civicrm_acl',
297 'entity' => 'ACL',
298 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 299 'localizable' => 0,
a9d0587b 300 'add' => '1.6',
c3fc2621
CW
301 ],
302 'is_active' => [
e501603b
TO
303 'name' => 'is_active',
304 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 305 'title' => ts('ACL Is Active?'),
215b423e 306 'description' => ts('Is this property active?'),
a36434b9 307 'where' => 'civicrm_acl.is_active',
522a26c9 308 'table_name' => 'civicrm_acl',
309 'entity' => 'ACL',
310 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 311 'localizable' => 0,
c3fc2621 312 'html' => [
a510f6fb 313 'type' => 'CheckBox',
c3fc2621 314 ],
a9d0587b 315 'add' => '1.6',
c3fc2621
CW
316 ],
317 ];
346aaaba 318 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 319 }
346aaaba 320 return Civi::$statics[__CLASS__]['fields'];
e501603b 321 }
c3fc2621 322
e501603b 323 /**
bd8e0b14 324 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
325 *
326 * @return array
bd8e0b14 327 * Array(string $name => string $uniqueName).
e501603b 328 */
c3fc2621 329 public static function &fieldKeys() {
bd8e0b14
TO
330 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
331 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 332 }
bd8e0b14 333 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 334 }
c3fc2621 335
e501603b
TO
336 /**
337 * Returns the names of this table
338 *
339 * @return string
340 */
c3fc2621 341 public static function getTableName() {
e501603b
TO
342 return self::$_tableName;
343 }
c3fc2621 344
e501603b
TO
345 /**
346 * Returns if this table needs to be logged
347 *
c3fc2621 348 * @return bool
e501603b 349 */
c3fc2621 350 public function getLog() {
e501603b
TO
351 return self::$_log;
352 }
c3fc2621 353
e501603b
TO
354 /**
355 * Returns the list of fields that can be imported
356 *
357 * @param bool $prefix
358 *
359 * @return array
360 */
c3fc2621
CW
361 public static function &import($prefix = FALSE) {
362 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'acl', $prefix, []);
60808919 363 return $r;
e501603b 364 }
c3fc2621 365
e501603b
TO
366 /**
367 * Returns the list of fields that can be exported
368 *
369 * @param bool $prefix
370 *
371 * @return array
372 */
c3fc2621
CW
373 public static function &export($prefix = FALSE) {
374 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'acl', $prefix, []);
60808919 375 return $r;
e501603b 376 }
c3fc2621 377
e7a6b91a
AS
378 /**
379 * Returns the list of indices
c3fc2621
CW
380 *
381 * @param bool $localize
382 *
383 * @return array
e7a6b91a
AS
384 */
385 public static function indices($localize = TRUE) {
c3fc2621
CW
386 $indices = [
387 'index_acl_id' => [
e7a6b91a 388 'name' => 'index_acl_id',
c3fc2621 389 'field' => [
e7a6b91a 390 0 => 'acl_id',
c3fc2621
CW
391 ],
392 'localizable' => FALSE,
e7a6b91a 393 'sig' => 'civicrm_acl::0::acl_id',
c3fc2621
CW
394 ],
395 ];
e7a6b91a
AS
396 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
397 }
c3fc2621 398
e501603b 399}