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