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