Merge pull request #11216 from mydropwizard/crm-21372
[civicrm-core.git] / CRM / ACL / DAO / ACL.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
0f03f337 6| Copyright CiviCRM LLC (c) 2004-2017 |
e501603b
TO
7+--------------------------------------------------------------------+
8| This file is a part of CiviCRM. |
9| |
10| CiviCRM is free software; you can copy, modify, and distribute it |
11| under the terms of the GNU Affero General Public License |
12| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13| |
14| CiviCRM is distributed in the hope that it will be useful, but |
15| WITHOUT ANY WARRANTY; without even the implied warranty of |
16| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17| See the GNU Affero General Public License for more details. |
18| |
19| You should have received a copy of the GNU Affero General Public |
20| License and the CiviCRM Licensing Exception along |
21| with this program; if not, contact CiviCRM LLC |
22| at info[AT]civicrm[DOT]org. If you have questions about the |
23| GNU Affero General Public License or the licensing of CiviCRM, |
24| see the CiviCRM license FAQ at http://civicrm.org/licensing |
25+--------------------------------------------------------------------+
26*/
27/**
28 * @package CRM
0f03f337 29 * @copyright CiviCRM LLC (c) 2004-2017
e501603b
TO
30 *
31 * Generated from xml/schema/CRM/ACL/ACL.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
a510f6fb 33 * (GenCodeChecksum:f56c9ad63ff247e68abf2c7c70ff65ba)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
f41f0342 37/**
38 * CRM_ACL_DAO_ACL constructor.
39 */
e501603b
TO
40class CRM_ACL_DAO_ACL extends CRM_Core_DAO {
41 /**
f41f0342 42 * Static instance to hold the table name.
e501603b
TO
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_acl';
e501603b 47 /**
f41f0342 48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b
TO
49 *
50 * @var boolean
51 */
52 static $_log = false;
53 /**
54 * Unique table ID
55 *
56 * @var int unsigned
57 */
58 public $id;
59 /**
60 * ACL Name.
61 *
62 * @var string
63 */
64 public $name;
65 /**
66 * Is this ACL entry Allow (0) or Deny (1) ?
67 *
68 * @var boolean
69 */
70 public $deny;
71 /**
72 * Table of the object possessing this ACL entry (Contact, Group, or ACL Group)
73 *
74 * @var string
75 */
76 public $entity_table;
77 /**
78 * ID of the object possessing this ACL
79 *
80 * @var int unsigned
81 */
82 public $entity_id;
83 /**
84 * What operation does this ACL entry control?
85 *
86 * @var string
87 */
88 public $operation;
89 /**
90 * The table of the object controlled by this ACL entry
91 *
92 * @var string
93 */
94 public $object_table;
95 /**
96 * The ID of the object controlled by this ACL entry
97 *
98 * @var int unsigned
99 */
100 public $object_id;
101 /**
102 * If this is a grant/revoke entry, what table are we granting?
103 *
104 * @var string
105 */
106 public $acl_table;
107 /**
108 * ID of the ACL or ACL group being granted/revoked
109 *
110 * @var int unsigned
111 */
112 public $acl_id;
113 /**
114 * Is this property active?
115 *
116 * @var boolean
117 */
118 public $is_active;
119 /**
f41f0342 120 * Class constructor.
e501603b
TO
121 */
122 function __construct() {
123 $this->__table = 'civicrm_acl';
124 parent::__construct();
125 }
126 /**
f41f0342 127 * Returns foreign keys and entity references.
e501603b
TO
128 *
129 * @return array
130 * [CRM_Core_Reference_Interface]
131 */
132 static function getReferenceColumns() {
346aaaba
TO
133 if (!isset(Civi::$statics[__CLASS__]['links'])) {
134 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
135 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table');
136 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 137 }
346aaaba 138 return Civi::$statics[__CLASS__]['links'];
e501603b
TO
139 }
140 /**
141 * Returns all the column names of this table
142 *
143 * @return array
144 */
145 static function &fields() {
346aaaba
TO
146 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
147 Civi::$statics[__CLASS__]['fields'] = array(
e501603b
TO
148 'id' => array(
149 'name' => 'id',
150 'type' => CRM_Utils_Type::T_INT,
151 'title' => ts('ACL ID') ,
152 'description' => 'Unique table ID',
153 'required' => true,
522a26c9 154 'table_name' => 'civicrm_acl',
155 'entity' => 'ACL',
156 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 157 'localizable' => 0,
e501603b
TO
158 ) ,
159 'name' => array(
160 'name' => 'name',
161 'type' => CRM_Utils_Type::T_STRING,
162 'title' => ts('ACL Name') ,
163 'description' => 'ACL Name.',
164 'maxlength' => 64,
165 'size' => CRM_Utils_Type::BIG,
522a26c9 166 'table_name' => 'civicrm_acl',
167 'entity' => 'ACL',
168 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 169 'localizable' => 0,
e501603b
TO
170 'html' => array(
171 'type' => 'Text',
172 ) ,
173 ) ,
174 'deny' => array(
175 'name' => 'deny',
176 'type' => CRM_Utils_Type::T_BOOLEAN,
177 'title' => ts('Deny ACL?') ,
178 'description' => 'Is this ACL entry Allow (0) or Deny (1) ?',
179 'required' => true,
522a26c9 180 'table_name' => 'civicrm_acl',
181 'entity' => 'ACL',
182 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 183 'localizable' => 0,
e501603b
TO
184 'html' => array(
185 'type' => 'Radio',
186 ) ,
187 ) ,
188 'entity_table' => array(
189 'name' => 'entity_table',
190 'type' => CRM_Utils_Type::T_STRING,
191 'title' => ts('ACL Entity') ,
192 'description' => 'Table of the object possessing this ACL entry (Contact, Group, or ACL Group)',
193 'required' => true,
194 'maxlength' => 64,
195 'size' => CRM_Utils_Type::BIG,
522a26c9 196 'table_name' => 'civicrm_acl',
197 'entity' => 'ACL',
198 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 199 'localizable' => 0,
e501603b
TO
200 ) ,
201 'entity_id' => array(
202 'name' => 'entity_id',
203 'type' => CRM_Utils_Type::T_INT,
204 'title' => ts('Entity ID') ,
205 'description' => 'ID of the object possessing this ACL',
522a26c9 206 'table_name' => 'civicrm_acl',
207 'entity' => 'ACL',
208 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 209 'localizable' => 0,
e501603b
TO
210 ) ,
211 'operation' => array(
212 'name' => 'operation',
213 'type' => CRM_Utils_Type::T_STRING,
214 'title' => ts('ACL Operation') ,
215 'description' => 'What operation does this ACL entry control?',
216 'required' => true,
217 'maxlength' => 8,
218 'size' => CRM_Utils_Type::EIGHT,
522a26c9 219 'table_name' => 'civicrm_acl',
220 'entity' => 'ACL',
221 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 222 'localizable' => 0,
e501603b
TO
223 'html' => array(
224 'type' => 'Select',
225 ) ,
226 'pseudoconstant' => array(
227 'callback' => 'CRM_ACL_BAO_ACL::operation',
228 )
229 ) ,
230 'object_table' => array(
231 'name' => 'object_table',
232 'type' => CRM_Utils_Type::T_STRING,
233 'title' => ts('ACL Object') ,
234 'description' => 'The table of the object controlled by this ACL entry',
235 'maxlength' => 64,
236 'size' => CRM_Utils_Type::BIG,
522a26c9 237 'table_name' => 'civicrm_acl',
238 'entity' => 'ACL',
239 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 240 'localizable' => 0,
e501603b
TO
241 ) ,
242 'object_id' => array(
243 'name' => 'object_id',
244 'type' => CRM_Utils_Type::T_INT,
245 'title' => ts('ACL Object ID') ,
246 'description' => 'The ID of the object controlled by this ACL entry',
522a26c9 247 'table_name' => 'civicrm_acl',
248 'entity' => 'ACL',
249 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 250 'localizable' => 0,
e501603b
TO
251 ) ,
252 'acl_table' => array(
253 'name' => 'acl_table',
254 'type' => CRM_Utils_Type::T_STRING,
255 'title' => ts('ACL Table') ,
256 'description' => 'If this is a grant/revoke entry, what table are we granting?',
257 'maxlength' => 64,
258 'size' => CRM_Utils_Type::BIG,
522a26c9 259 'table_name' => 'civicrm_acl',
260 'entity' => 'ACL',
261 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 262 'localizable' => 0,
e501603b
TO
263 ) ,
264 'acl_id' => array(
265 'name' => 'acl_id',
266 'type' => CRM_Utils_Type::T_INT,
267 'title' => ts('ACL Group ID') ,
268 'description' => 'ID of the ACL or ACL group being granted/revoked',
522a26c9 269 'table_name' => 'civicrm_acl',
270 'entity' => 'ACL',
271 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 272 'localizable' => 0,
e501603b
TO
273 ) ,
274 'is_active' => array(
275 'name' => 'is_active',
276 'type' => CRM_Utils_Type::T_BOOLEAN,
277 'title' => ts('ACL Is Active?') ,
278 'description' => 'Is this property active?',
522a26c9 279 'table_name' => 'civicrm_acl',
280 'entity' => 'ACL',
281 'bao' => 'CRM_ACL_BAO_ACL',
6a7e5e5d 282 'localizable' => 0,
e501603b 283 'html' => array(
a510f6fb 284 'type' => 'CheckBox',
e501603b
TO
285 ) ,
286 ) ,
287 );
346aaaba 288 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 289 }
346aaaba 290 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
291 }
292 /**
bd8e0b14 293 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
294 *
295 * @return array
bd8e0b14 296 * Array(string $name => string $uniqueName).
e501603b
TO
297 */
298 static function &fieldKeys() {
bd8e0b14
TO
299 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
300 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 301 }
bd8e0b14 302 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
303 }
304 /**
305 * Returns the names of this table
306 *
307 * @return string
308 */
309 static function getTableName() {
310 return self::$_tableName;
311 }
312 /**
313 * Returns if this table needs to be logged
314 *
315 * @return boolean
316 */
317 function getLog() {
318 return self::$_log;
319 }
320 /**
321 * Returns the list of fields that can be imported
322 *
323 * @param bool $prefix
324 *
325 * @return array
326 */
327 static function &import($prefix = false) {
60808919
TO
328 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'acl', $prefix, array());
329 return $r;
e501603b
TO
330 }
331 /**
332 * Returns the list of fields that can be exported
333 *
334 * @param bool $prefix
335 *
336 * @return array
337 */
338 static function &export($prefix = false) {
60808919
TO
339 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'acl', $prefix, array());
340 return $r;
e501603b 341 }
e7a6b91a
AS
342 /**
343 * Returns the list of indices
344 */
345 public static function indices($localize = TRUE) {
346 $indices = array(
347 'index_acl_id' => array(
348 'name' => 'index_acl_id',
349 'field' => array(
350 0 => 'acl_id',
351 ) ,
352 'localizable' => false,
353 'sig' => 'civicrm_acl::0::acl_id',
354 ) ,
355 );
356 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
357 }
e501603b 358}