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