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