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