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