Merge pull request #18419 from colemanw/improveCustomFieldForm
[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
929a1c14 9 * (GenCodeChecksum:f75eaa0ee87675c14a224ec22b2c30a7)
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.
120 */
121 public static function getEntityTitle() {
122 return ts('ACLs');
123 }
124
e501603b 125 /**
f41f0342 126 * Returns foreign keys and entity references.
e501603b
TO
127 *
128 * @return array
129 * [CRM_Core_Reference_Interface]
130 */
c3fc2621 131 public static function getReferenceColumns() {
346aaaba 132 if (!isset(Civi::$statics[__CLASS__]['links'])) {
cf0d1c08 133 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621 134 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
346aaaba 135 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 136 }
346aaaba 137 return Civi::$statics[__CLASS__]['links'];
e501603b 138 }
c3fc2621 139
e501603b
TO
140 /**
141 * Returns all the column names of this table
142 *
143 * @return array
144 */
c3fc2621 145 public static function &fields() {
346aaaba 146 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
147 Civi::$statics[__CLASS__]['fields'] = [
148 'id' => [
e501603b
TO
149 'name' => 'id',
150 'type' => CRM_Utils_Type::T_INT,
c3fc2621 151 'title' => ts('ACL ID'),
215b423e 152 'description' => ts('Unique table ID'),
c3fc2621 153 'required' => TRUE,
a36434b9 154 'where' => 'civicrm_acl.id',
522a26c9 155 'table_name' => 'civicrm_acl',
156 'entity' => 'ACL',
157 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 158 'localizable' => 0,
a9d0587b 159 'add' => '1.6',
c3fc2621
CW
160 ],
161 'name' => [
e501603b
TO
162 'name' => 'name',
163 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 164 'title' => ts('ACL Name'),
215b423e 165 'description' => ts('ACL Name.'),
e501603b
TO
166 'maxlength' => 64,
167 'size' => CRM_Utils_Type::BIG,
a36434b9 168 'where' => 'civicrm_acl.name',
522a26c9 169 'table_name' => 'civicrm_acl',
170 'entity' => 'ACL',
171 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 172 'localizable' => 0,
c3fc2621 173 'html' => [
e501603b 174 'type' => 'Text',
c3fc2621 175 ],
a9d0587b 176 'add' => '1.6',
c3fc2621
CW
177 ],
178 'deny' => [
e501603b
TO
179 'name' => 'deny',
180 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 181 'title' => ts('Deny ACL?'),
215b423e 182 'description' => ts('Is this ACL entry Allow (0) or Deny (1) ?'),
c3fc2621 183 'required' => TRUE,
a36434b9 184 'where' => 'civicrm_acl.deny',
45a83e42 185 'default' => '0',
522a26c9 186 'table_name' => 'civicrm_acl',
187 'entity' => 'ACL',
188 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 189 'localizable' => 0,
c3fc2621 190 'html' => [
e501603b 191 'type' => 'Radio',
c3fc2621 192 ],
a9d0587b 193 'add' => '1.6',
c3fc2621
CW
194 ],
195 'entity_table' => [
e501603b
TO
196 'name' => 'entity_table',
197 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 198 'title' => ts('ACL Entity'),
215b423e 199 'description' => ts('Table of the object possessing this ACL entry (Contact, Group, or ACL Group)'),
c3fc2621 200 'required' => TRUE,
e501603b
TO
201 'maxlength' => 64,
202 'size' => CRM_Utils_Type::BIG,
a36434b9 203 'where' => 'civicrm_acl.entity_table',
522a26c9 204 'table_name' => 'civicrm_acl',
205 'entity' => 'ACL',
206 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 207 'localizable' => 0,
a9d0587b 208 'add' => '1.6',
c3fc2621
CW
209 ],
210 'entity_id' => [
e501603b
TO
211 'name' => 'entity_id',
212 'type' => CRM_Utils_Type::T_INT,
c3fc2621 213 'title' => ts('Entity ID'),
215b423e 214 'description' => ts('ID of the object possessing this ACL'),
a36434b9 215 'where' => 'civicrm_acl.entity_id',
522a26c9 216 'table_name' => 'civicrm_acl',
217 'entity' => 'ACL',
218 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 219 'localizable' => 0,
a9d0587b 220 'add' => '1.6',
c3fc2621
CW
221 ],
222 'operation' => [
e501603b
TO
223 'name' => 'operation',
224 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 225 'title' => ts('ACL Operation'),
215b423e 226 'description' => ts('What operation does this ACL entry control?'),
c3fc2621 227 'required' => TRUE,
e501603b
TO
228 'maxlength' => 8,
229 'size' => CRM_Utils_Type::EIGHT,
a36434b9 230 'where' => 'civicrm_acl.operation',
522a26c9 231 'table_name' => 'civicrm_acl',
232 'entity' => 'ACL',
233 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 234 'localizable' => 0,
c3fc2621 235 'html' => [
e501603b 236 'type' => 'Select',
c3fc2621
CW
237 ],
238 'pseudoconstant' => [
e501603b 239 'callback' => 'CRM_ACL_BAO_ACL::operation',
800d9240 240 ],
a9d0587b 241 'add' => '1.6',
c3fc2621
CW
242 ],
243 'object_table' => [
e501603b
TO
244 'name' => 'object_table',
245 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 246 'title' => ts('ACL Object'),
215b423e 247 'description' => ts('The table of the object controlled by this ACL entry'),
e501603b
TO
248 'maxlength' => 64,
249 'size' => CRM_Utils_Type::BIG,
a36434b9 250 'where' => 'civicrm_acl.object_table',
522a26c9 251 'table_name' => 'civicrm_acl',
252 'entity' => 'ACL',
253 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 254 'localizable' => 0,
a9d0587b 255 'add' => '1.6',
c3fc2621
CW
256 ],
257 'object_id' => [
e501603b
TO
258 'name' => 'object_id',
259 'type' => CRM_Utils_Type::T_INT,
c3fc2621 260 'title' => ts('ACL Object ID'),
215b423e 261 'description' => ts('The ID of the object controlled by this ACL entry'),
a36434b9 262 'where' => 'civicrm_acl.object_id',
522a26c9 263 'table_name' => 'civicrm_acl',
264 'entity' => 'ACL',
265 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 266 'localizable' => 0,
a9d0587b 267 'add' => '1.6',
c3fc2621
CW
268 ],
269 'acl_table' => [
e501603b
TO
270 'name' => 'acl_table',
271 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 272 'title' => ts('ACL Table'),
215b423e 273 'description' => ts('If this is a grant/revoke entry, what table are we granting?'),
e501603b
TO
274 'maxlength' => 64,
275 'size' => CRM_Utils_Type::BIG,
a36434b9 276 'where' => 'civicrm_acl.acl_table',
522a26c9 277 'table_name' => 'civicrm_acl',
278 'entity' => 'ACL',
279 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 280 'localizable' => 0,
a9d0587b 281 'add' => '1.6',
c3fc2621
CW
282 ],
283 'acl_id' => [
e501603b
TO
284 'name' => 'acl_id',
285 'type' => CRM_Utils_Type::T_INT,
c3fc2621 286 'title' => ts('ACL Group ID'),
215b423e 287 'description' => ts('ID of the ACL or ACL group being granted/revoked'),
a36434b9 288 'where' => 'civicrm_acl.acl_id',
522a26c9 289 'table_name' => 'civicrm_acl',
290 'entity' => 'ACL',
291 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 292 'localizable' => 0,
a9d0587b 293 'add' => '1.6',
c3fc2621
CW
294 ],
295 'is_active' => [
e501603b
TO
296 'name' => 'is_active',
297 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 298 'title' => ts('ACL Is Active?'),
215b423e 299 'description' => ts('Is this property active?'),
a36434b9 300 'where' => 'civicrm_acl.is_active',
522a26c9 301 'table_name' => 'civicrm_acl',
302 'entity' => 'ACL',
303 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 304 'localizable' => 0,
c3fc2621 305 'html' => [
a510f6fb 306 'type' => 'CheckBox',
c3fc2621 307 ],
a9d0587b 308 'add' => '1.6',
c3fc2621
CW
309 ],
310 ];
346aaaba 311 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 312 }
346aaaba 313 return Civi::$statics[__CLASS__]['fields'];
e501603b 314 }
c3fc2621 315
e501603b 316 /**
bd8e0b14 317 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
318 *
319 * @return array
bd8e0b14 320 * Array(string $name => string $uniqueName).
e501603b 321 */
c3fc2621 322 public static function &fieldKeys() {
bd8e0b14
TO
323 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
324 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 325 }
bd8e0b14 326 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 327 }
c3fc2621 328
e501603b
TO
329 /**
330 * Returns the names of this table
331 *
332 * @return string
333 */
c3fc2621 334 public static function getTableName() {
e501603b
TO
335 return self::$_tableName;
336 }
c3fc2621 337
e501603b
TO
338 /**
339 * Returns if this table needs to be logged
340 *
c3fc2621 341 * @return bool
e501603b 342 */
c3fc2621 343 public function getLog() {
e501603b
TO
344 return self::$_log;
345 }
c3fc2621 346
e501603b
TO
347 /**
348 * Returns the list of fields that can be imported
349 *
350 * @param bool $prefix
351 *
352 * @return array
353 */
c3fc2621
CW
354 public static function &import($prefix = FALSE) {
355 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'acl', $prefix, []);
60808919 356 return $r;
e501603b 357 }
c3fc2621 358
e501603b
TO
359 /**
360 * Returns the list of fields that can be exported
361 *
362 * @param bool $prefix
363 *
364 * @return array
365 */
c3fc2621
CW
366 public static function &export($prefix = FALSE) {
367 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'acl', $prefix, []);
60808919 368 return $r;
e501603b 369 }
c3fc2621 370
e7a6b91a
AS
371 /**
372 * Returns the list of indices
c3fc2621
CW
373 *
374 * @param bool $localize
375 *
376 * @return array
e7a6b91a
AS
377 */
378 public static function indices($localize = TRUE) {
c3fc2621
CW
379 $indices = [
380 'index_acl_id' => [
e7a6b91a 381 'name' => 'index_acl_id',
c3fc2621 382 'field' => [
e7a6b91a 383 0 => 'acl_id',
c3fc2621
CW
384 ],
385 'localizable' => FALSE,
e7a6b91a 386 'sig' => 'civicrm_acl::0::acl_id',
c3fc2621
CW
387 ],
388 ];
e7a6b91a
AS
389 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
390 }
c3fc2621 391
e501603b 392}