Merge pull request #9668 from colemanw/CRM-19864
[civicrm-core.git] / CRM / ACL / DAO / ACL.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
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
29 * @copyright CiviCRM LLC (c) 2004-2017
30 *
31 * Generated from xml/schema/CRM/ACL/ACL.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:64a0037ac9582a2b613798886028013e)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 /**
38 * CRM_ACL_DAO_ACL constructor.
39 */
40 class CRM_ACL_DAO_ACL extends CRM_Core_DAO {
41 /**
42 * Static instance to hold the table name.
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_acl';
47 /**
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
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 /**
120 * Class constructor.
121 */
122 function __construct() {
123 $this->__table = 'civicrm_acl';
124 parent::__construct();
125 }
126 /**
127 * Returns foreign keys and entity references.
128 *
129 * @return array
130 * [CRM_Core_Reference_Interface]
131 */
132 static function getReferenceColumns() {
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']);
137 }
138 return Civi::$statics[__CLASS__]['links'];
139 }
140 /**
141 * Returns all the column names of this table
142 *
143 * @return array
144 */
145 static function &fields() {
146 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
147 Civi::$statics[__CLASS__]['fields'] = array(
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,
154 'table_name' => 'civicrm_acl',
155 'entity' => 'ACL',
156 'bao' => 'CRM_ACL_BAO_ACL',
157 ) ,
158 'name' => array(
159 'name' => 'name',
160 'type' => CRM_Utils_Type::T_STRING,
161 'title' => ts('ACL Name') ,
162 'description' => 'ACL Name.',
163 'maxlength' => 64,
164 'size' => CRM_Utils_Type::BIG,
165 'table_name' => 'civicrm_acl',
166 'entity' => 'ACL',
167 'bao' => 'CRM_ACL_BAO_ACL',
168 'html' => array(
169 'type' => 'Text',
170 ) ,
171 ) ,
172 'deny' => array(
173 'name' => 'deny',
174 'type' => CRM_Utils_Type::T_BOOLEAN,
175 'title' => ts('Deny ACL?') ,
176 'description' => 'Is this ACL entry Allow (0) or Deny (1) ?',
177 'required' => true,
178 'table_name' => 'civicrm_acl',
179 'entity' => 'ACL',
180 'bao' => 'CRM_ACL_BAO_ACL',
181 'html' => array(
182 'type' => 'Radio',
183 ) ,
184 ) ,
185 'entity_table' => array(
186 'name' => 'entity_table',
187 'type' => CRM_Utils_Type::T_STRING,
188 'title' => ts('ACL Entity') ,
189 'description' => 'Table of the object possessing this ACL entry (Contact, Group, or ACL Group)',
190 'required' => true,
191 'maxlength' => 64,
192 'size' => CRM_Utils_Type::BIG,
193 'table_name' => 'civicrm_acl',
194 'entity' => 'ACL',
195 'bao' => 'CRM_ACL_BAO_ACL',
196 ) ,
197 'entity_id' => array(
198 'name' => 'entity_id',
199 'type' => CRM_Utils_Type::T_INT,
200 'title' => ts('Entity ID') ,
201 'description' => 'ID of the object possessing this ACL',
202 'table_name' => 'civicrm_acl',
203 'entity' => 'ACL',
204 'bao' => 'CRM_ACL_BAO_ACL',
205 ) ,
206 'operation' => array(
207 'name' => 'operation',
208 'type' => CRM_Utils_Type::T_STRING,
209 'title' => ts('ACL Operation') ,
210 'description' => 'What operation does this ACL entry control?',
211 'required' => true,
212 'maxlength' => 8,
213 'size' => CRM_Utils_Type::EIGHT,
214 'table_name' => 'civicrm_acl',
215 'entity' => 'ACL',
216 'bao' => 'CRM_ACL_BAO_ACL',
217 'html' => array(
218 'type' => 'Select',
219 ) ,
220 'pseudoconstant' => array(
221 'callback' => 'CRM_ACL_BAO_ACL::operation',
222 )
223 ) ,
224 'object_table' => array(
225 'name' => 'object_table',
226 'type' => CRM_Utils_Type::T_STRING,
227 'title' => ts('ACL Object') ,
228 'description' => 'The table of the object controlled by this ACL entry',
229 'maxlength' => 64,
230 'size' => CRM_Utils_Type::BIG,
231 'table_name' => 'civicrm_acl',
232 'entity' => 'ACL',
233 'bao' => 'CRM_ACL_BAO_ACL',
234 ) ,
235 'object_id' => array(
236 'name' => 'object_id',
237 'type' => CRM_Utils_Type::T_INT,
238 'title' => ts('ACL Object ID') ,
239 'description' => 'The ID of the object controlled by this ACL entry',
240 'table_name' => 'civicrm_acl',
241 'entity' => 'ACL',
242 'bao' => 'CRM_ACL_BAO_ACL',
243 ) ,
244 'acl_table' => array(
245 'name' => 'acl_table',
246 'type' => CRM_Utils_Type::T_STRING,
247 'title' => ts('ACL Table') ,
248 'description' => 'If this is a grant/revoke entry, what table are we granting?',
249 'maxlength' => 64,
250 'size' => CRM_Utils_Type::BIG,
251 'table_name' => 'civicrm_acl',
252 'entity' => 'ACL',
253 'bao' => 'CRM_ACL_BAO_ACL',
254 ) ,
255 'acl_id' => array(
256 'name' => 'acl_id',
257 'type' => CRM_Utils_Type::T_INT,
258 'title' => ts('ACL Group ID') ,
259 'description' => 'ID of the ACL or ACL group being granted/revoked',
260 'table_name' => 'civicrm_acl',
261 'entity' => 'ACL',
262 'bao' => 'CRM_ACL_BAO_ACL',
263 ) ,
264 'is_active' => array(
265 'name' => 'is_active',
266 'type' => CRM_Utils_Type::T_BOOLEAN,
267 'title' => ts('ACL Is Active?') ,
268 'description' => 'Is this property active?',
269 'table_name' => 'civicrm_acl',
270 'entity' => 'ACL',
271 'bao' => 'CRM_ACL_BAO_ACL',
272 'html' => array(
273 'type' => 'Checkbox',
274 ) ,
275 ) ,
276 );
277 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
278 }
279 return Civi::$statics[__CLASS__]['fields'];
280 }
281 /**
282 * Return a mapping from field-name to the corresponding key (as used in fields()).
283 *
284 * @return array
285 * Array(string $name => string $uniqueName).
286 */
287 static function &fieldKeys() {
288 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
289 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
290 }
291 return Civi::$statics[__CLASS__]['fieldKeys'];
292 }
293 /**
294 * Returns the names of this table
295 *
296 * @return string
297 */
298 static function getTableName() {
299 return self::$_tableName;
300 }
301 /**
302 * Returns if this table needs to be logged
303 *
304 * @return boolean
305 */
306 function getLog() {
307 return self::$_log;
308 }
309 /**
310 * Returns the list of fields that can be imported
311 *
312 * @param bool $prefix
313 *
314 * @return array
315 */
316 static function &import($prefix = false) {
317 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'acl', $prefix, array());
318 return $r;
319 }
320 /**
321 * Returns the list of fields that can be exported
322 *
323 * @param bool $prefix
324 *
325 * @return array
326 */
327 static function &export($prefix = false) {
328 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'acl', $prefix, array());
329 return $r;
330 }
331 }