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