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