Merge pull request #8899 from JKingsnorth/CRM-19179
[civicrm-core.git] / CRM / ACL / DAO / ACL.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2016 |
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-2016
30 *
31 * Generated from xml/schema/CRM/ACL/ACL.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:5727b59234c51d62e5d279c582cbd95b)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_ACL_DAO_ACL extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_acl';
44 /**
45 * static value to see if we should log any modifications to
46 * this table in the civicrm_log table
47 *
48 * @var boolean
49 */
50 static $_log = false;
51 /**
52 * Unique table ID
53 *
54 * @var int unsigned
55 */
56 public $id;
57 /**
58 * ACL Name.
59 *
60 * @var string
61 */
62 public $name;
63 /**
64 * Is this ACL entry Allow (0) or Deny (1) ?
65 *
66 * @var boolean
67 */
68 public $deny;
69 /**
70 * Table of the object possessing this ACL entry (Contact, Group, or ACL Group)
71 *
72 * @var string
73 */
74 public $entity_table;
75 /**
76 * ID of the object possessing this ACL
77 *
78 * @var int unsigned
79 */
80 public $entity_id;
81 /**
82 * What operation does this ACL entry control?
83 *
84 * @var string
85 */
86 public $operation;
87 /**
88 * The table of the object controlled by this ACL entry
89 *
90 * @var string
91 */
92 public $object_table;
93 /**
94 * The ID of the object controlled by this ACL entry
95 *
96 * @var int unsigned
97 */
98 public $object_id;
99 /**
100 * If this is a grant/revoke entry, what table are we granting?
101 *
102 * @var string
103 */
104 public $acl_table;
105 /**
106 * ID of the ACL or ACL group being granted/revoked
107 *
108 * @var int unsigned
109 */
110 public $acl_id;
111 /**
112 * Is this property active?
113 *
114 * @var boolean
115 */
116 public $is_active;
117 /**
118 * class constructor
119 *
120 * @return civicrm_acl
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 ) ,
155 'name' => array(
156 'name' => 'name',
157 'type' => CRM_Utils_Type::T_STRING,
158 'title' => ts('ACL Name') ,
159 'description' => 'ACL Name.',
160 'maxlength' => 64,
161 'size' => CRM_Utils_Type::BIG,
162 'html' => array(
163 'type' => 'Text',
164 ) ,
165 ) ,
166 'deny' => array(
167 'name' => 'deny',
168 'type' => CRM_Utils_Type::T_BOOLEAN,
169 'title' => ts('Deny ACL?') ,
170 'description' => 'Is this ACL entry Allow (0) or Deny (1) ?',
171 'required' => true,
172 'html' => array(
173 'type' => 'Radio',
174 ) ,
175 ) ,
176 'entity_table' => array(
177 'name' => 'entity_table',
178 'type' => CRM_Utils_Type::T_STRING,
179 'title' => ts('ACL Entity') ,
180 'description' => 'Table of the object possessing this ACL entry (Contact, Group, or ACL Group)',
181 'required' => true,
182 'maxlength' => 64,
183 'size' => CRM_Utils_Type::BIG,
184 ) ,
185 'entity_id' => array(
186 'name' => 'entity_id',
187 'type' => CRM_Utils_Type::T_INT,
188 'title' => ts('Entity ID') ,
189 'description' => 'ID of the object possessing this ACL',
190 ) ,
191 'operation' => array(
192 'name' => 'operation',
193 'type' => CRM_Utils_Type::T_STRING,
194 'title' => ts('ACL Operation') ,
195 'description' => 'What operation does this ACL entry control?',
196 'required' => true,
197 'maxlength' => 8,
198 'size' => CRM_Utils_Type::EIGHT,
199 'html' => array(
200 'type' => 'Select',
201 ) ,
202 'pseudoconstant' => array(
203 'callback' => 'CRM_ACL_BAO_ACL::operation',
204 )
205 ) ,
206 'object_table' => array(
207 'name' => 'object_table',
208 'type' => CRM_Utils_Type::T_STRING,
209 'title' => ts('ACL Object') ,
210 'description' => 'The table of the object controlled by this ACL entry',
211 'maxlength' => 64,
212 'size' => CRM_Utils_Type::BIG,
213 ) ,
214 'object_id' => array(
215 'name' => 'object_id',
216 'type' => CRM_Utils_Type::T_INT,
217 'title' => ts('ACL Object ID') ,
218 'description' => 'The ID of the object controlled by this ACL entry',
219 ) ,
220 'acl_table' => array(
221 'name' => 'acl_table',
222 'type' => CRM_Utils_Type::T_STRING,
223 'title' => ts('ACL Table') ,
224 'description' => 'If this is a grant/revoke entry, what table are we granting?',
225 'maxlength' => 64,
226 'size' => CRM_Utils_Type::BIG,
227 ) ,
228 'acl_id' => array(
229 'name' => 'acl_id',
230 'type' => CRM_Utils_Type::T_INT,
231 'title' => ts('ACL Group ID') ,
232 'description' => 'ID of the ACL or ACL group being granted/revoked',
233 ) ,
234 'is_active' => array(
235 'name' => 'is_active',
236 'type' => CRM_Utils_Type::T_BOOLEAN,
237 'title' => ts('ACL Is Active?') ,
238 'description' => 'Is this property active?',
239 'html' => array(
240 'type' => 'Checkbox',
241 ) ,
242 ) ,
243 );
244 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
245 }
246 return Civi::$statics[__CLASS__]['fields'];
247 }
248 /**
249 * Return a mapping from field-name to the corresponding key (as used in fields()).
250 *
251 * @return array
252 * Array(string $name => string $uniqueName).
253 */
254 static function &fieldKeys() {
255 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
256 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
257 }
258 return Civi::$statics[__CLASS__]['fieldKeys'];
259 }
260 /**
261 * Returns the names of this table
262 *
263 * @return string
264 */
265 static function getTableName() {
266 return self::$_tableName;
267 }
268 /**
269 * Returns if this table needs to be logged
270 *
271 * @return boolean
272 */
273 function getLog() {
274 return self::$_log;
275 }
276 /**
277 * Returns the list of fields that can be imported
278 *
279 * @param bool $prefix
280 *
281 * @return array
282 */
283 static function &import($prefix = false) {
284 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'acl', $prefix, array());
285 return $r;
286 }
287 /**
288 * Returns the list of fields that can be exported
289 *
290 * @param bool $prefix
291 *
292 * @return array
293 */
294 static function &export($prefix = false) {
295 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'acl', $prefix, array());
296 return $r;
297 }
298 }