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