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