1 | <?php |
---|
2 | /*********************************************** |
---|
3 | * File : syncprovisioning.php |
---|
4 | * Project : Z-Push |
---|
5 | * Descr : WBXML AS12+ provisionign entities that |
---|
6 | * can be parsed directly (as a stream) from WBXML. |
---|
7 | * It is automatically decoded |
---|
8 | * according to $mapping, |
---|
9 | * and the Sync WBXML mappings. |
---|
10 | * |
---|
11 | * Created : 05.09.2011 |
---|
12 | * |
---|
13 | * Copyright 2007 - 2012 Zarafa Deutschland GmbH |
---|
14 | * |
---|
15 | * This program is free software: you can redistribute it and/or modify |
---|
16 | * it under the terms of the GNU Affero General Public License, version 3, |
---|
17 | * as published by the Free Software Foundation with the following additional |
---|
18 | * term according to sec. 7: |
---|
19 | * |
---|
20 | * According to sec. 7 of the GNU Affero General Public License, version 3, |
---|
21 | * the terms of the AGPL are supplemented with the following terms: |
---|
22 | * |
---|
23 | * "Zarafa" is a registered trademark of Zarafa B.V. |
---|
24 | * "Z-Push" is a registered trademark of Zarafa Deutschland GmbH |
---|
25 | * The licensing of the Program under the AGPL does not imply a trademark license. |
---|
26 | * Therefore any rights, title and interest in our trademarks remain entirely with us. |
---|
27 | * |
---|
28 | * However, if you propagate an unmodified version of the Program you are |
---|
29 | * allowed to use the term "Z-Push" to indicate that you distribute the Program. |
---|
30 | * Furthermore you may use our trademarks where it is necessary to indicate |
---|
31 | * the intended purpose of a product or service provided you use it in accordance |
---|
32 | * with honest practices in industrial or commercial matters. |
---|
33 | * If you want to propagate modified versions of the Program under the name "Z-Push", |
---|
34 | * you may only do so if you have a written permission by Zarafa Deutschland GmbH |
---|
35 | * (to acquire a permission please contact Zarafa at trademark@zarafa.com). |
---|
36 | * |
---|
37 | * This program is distributed in the hope that it will be useful, |
---|
38 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
39 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
40 | * GNU Affero General Public License for more details. |
---|
41 | * |
---|
42 | * You should have received a copy of the GNU Affero General Public License |
---|
43 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
44 | * |
---|
45 | * Consult LICENSE file for details |
---|
46 | ************************************************/ |
---|
47 | |
---|
48 | |
---|
49 | class SyncProvisioning extends SyncObject { |
---|
50 | //AS 12.0, 12.1 and 14.0 props |
---|
51 | public $devpwenabled; |
---|
52 | public $alphanumpwreq; |
---|
53 | public $devencenabled; |
---|
54 | public $pwrecoveryenabled; |
---|
55 | public $docbrowseenabled; |
---|
56 | public $attenabled; |
---|
57 | public $mindevpwlenngth; |
---|
58 | public $maxinacttimedevlock; |
---|
59 | public $maxdevpwfailedattempts; |
---|
60 | public $maxattsize; |
---|
61 | public $allowsimpledevpw; |
---|
62 | public $devpwexpiration; |
---|
63 | public $devpwhistory; |
---|
64 | |
---|
65 | //AS 12.1 and 14.0 props |
---|
66 | public $allostoragecard; |
---|
67 | public $allowcam; |
---|
68 | public $reqdevenc; |
---|
69 | public $allowunsignedapps; |
---|
70 | public $allowunsigninstallpacks; |
---|
71 | public $mindevcomplexchars; |
---|
72 | public $allowwifi; |
---|
73 | public $allowtextmessaging; |
---|
74 | public $allowpopimapemail; |
---|
75 | public $allowbluetooth; |
---|
76 | public $allowirda; |
---|
77 | public $reqmansyncroam; |
---|
78 | public $allowdesktopsync; |
---|
79 | public $maxcalagefilter; |
---|
80 | public $allowhtmlemail; |
---|
81 | public $maxemailagefilter; |
---|
82 | public $maxemailbodytruncsize; |
---|
83 | public $maxemailhtmlbodytruncsize; |
---|
84 | public $reqsignedsmimemessages; |
---|
85 | public $reqencsmimemessages; |
---|
86 | public $reqsignedsmimealgorithm; |
---|
87 | public $reqencsmimealgorithm; |
---|
88 | public $allowsmimeencalgneg; |
---|
89 | public $allowsmimesoftcerts; |
---|
90 | public $allowbrowser; |
---|
91 | public $allowconsumeremail; |
---|
92 | public $allowremotedesk; |
---|
93 | public $allowinternetsharing; |
---|
94 | public $unapprovedinromapplist; |
---|
95 | public $approvedapplist; |
---|
96 | |
---|
97 | function SyncProvisioning() { |
---|
98 | $mapping = array ( |
---|
99 | SYNC_PROVISION_DEVPWENABLED => array ( self::STREAMER_VAR => "devpwenabled", |
---|
100 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )), |
---|
101 | |
---|
102 | SYNC_PROVISION_ALPHANUMPWREQ => array ( self::STREAMER_VAR => "alphanumpwreq", |
---|
103 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )), |
---|
104 | |
---|
105 | SYNC_PROVISION_PWRECOVERYENABLED => array ( self::STREAMER_VAR => "pwrecoveryenabled", |
---|
106 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )), |
---|
107 | |
---|
108 | SYNC_PROVISION_DEVENCENABLED => array ( self::STREAMER_VAR => "devencenabled", |
---|
109 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )), |
---|
110 | |
---|
111 | SYNC_PROVISION_DOCBROWSEENABLED => array ( self::STREAMER_VAR => "docbrowseenabled"), // depricated |
---|
112 | SYNC_PROVISION_ATTENABLED => array ( self::STREAMER_VAR => "attenabled", |
---|
113 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )), |
---|
114 | |
---|
115 | SYNC_PROVISION_MINDEVPWLENGTH => array ( self::STREAMER_VAR => "mindevpwlenngth", |
---|
116 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_CMPHIGHER => 0, |
---|
117 | self::STREAMER_CHECK_CMPLOWER => 17 )), |
---|
118 | |
---|
119 | SYNC_PROVISION_MAXINACTTIMEDEVLOCK => array ( self::STREAMER_VAR => "maxinacttimedevlock"), |
---|
120 | SYNC_PROVISION_MAXDEVPWFAILEDATTEMPTS => array ( self::STREAMER_VAR => "maxdevpwfailedattempts", |
---|
121 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_CMPHIGHER => 3, |
---|
122 | self::STREAMER_CHECK_CMPLOWER => 17 )), |
---|
123 | |
---|
124 | SYNC_PROVISION_MAXATTSIZE => array ( self::STREAMER_VAR => "maxattsize", |
---|
125 | self::STREAMER_PROP => self::STREAMER_TYPE_SEND_EMPTY, |
---|
126 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_CMPHIGHER => -1 )), |
---|
127 | |
---|
128 | SYNC_PROVISION_ALLOWSIMPLEDEVPW => array ( self::STREAMER_VAR => "allowsimpledevpw", |
---|
129 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )), |
---|
130 | |
---|
131 | SYNC_PROVISION_DEVPWEXPIRATION => array ( self::STREAMER_VAR => "devpwexpiration", |
---|
132 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_CMPHIGHER => -1 )), |
---|
133 | |
---|
134 | SYNC_PROVISION_DEVPWHISTORY => array ( self::STREAMER_VAR => "devpwhistory", |
---|
135 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_CMPHIGHER => -1 )), |
---|
136 | ); |
---|
137 | |
---|
138 | if(Request::GetProtocolVersion() >= 12.1) { |
---|
139 | $mapping += array ( |
---|
140 | SYNC_PROVISION_ALLOWSTORAGECARD => array ( self::STREAMER_VAR => "allostoragecard", |
---|
141 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )), |
---|
142 | |
---|
143 | SYNC_PROVISION_ALLOWCAM => array ( self::STREAMER_VAR => "allowcam", |
---|
144 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )), |
---|
145 | |
---|
146 | SYNC_PROVISION_REQDEVENC => array ( self::STREAMER_VAR => "reqdevenc", |
---|
147 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )), |
---|
148 | |
---|
149 | SYNC_PROVISION_ALLOWUNSIGNEDAPPS => array ( self::STREAMER_VAR => "allowunsignedapps", |
---|
150 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )), |
---|
151 | |
---|
152 | SYNC_PROVISION_ALLOWUNSIGNEDINSTALLATIONPACKAGES => array ( self::STREAMER_VAR => "allowunsigninstallpacks", |
---|
153 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )), |
---|
154 | |
---|
155 | SYNC_PROVISION_MINDEVPWCOMPLEXCHARS => array ( self::STREAMER_VAR => "mindevcomplexchars", |
---|
156 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(1,2,3,4) )), |
---|
157 | |
---|
158 | SYNC_PROVISION_ALLOWWIFI => array ( self::STREAMER_VAR => "allowwifi", |
---|
159 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )), |
---|
160 | |
---|
161 | SYNC_PROVISION_ALLOWTEXTMESSAGING => array ( self::STREAMER_VAR => "allowtextmessaging", |
---|
162 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )), |
---|
163 | |
---|
164 | SYNC_PROVISION_ALLOWPOPIMAPEMAIL => array ( self::STREAMER_VAR => "allowpopimapemail", |
---|
165 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )), |
---|
166 | |
---|
167 | SYNC_PROVISION_ALLOWBLUETOOTH => array ( self::STREAMER_VAR => "allowbluetooth", |
---|
168 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1,2) )), |
---|
169 | |
---|
170 | SYNC_PROVISION_ALLOWIRDA => array ( self::STREAMER_VAR => "allowirda", |
---|
171 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )), |
---|
172 | |
---|
173 | SYNC_PROVISION_REQMANUALSYNCWHENROAM => array ( self::STREAMER_VAR => "reqmansyncroam", |
---|
174 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )), |
---|
175 | |
---|
176 | SYNC_PROVISION_ALLOWDESKTOPSYNC => array ( self::STREAMER_VAR => "allowdesktopsync", |
---|
177 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )), |
---|
178 | |
---|
179 | SYNC_PROVISION_MAXCALAGEFILTER => array ( self::STREAMER_VAR => "maxcalagefilter", |
---|
180 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,4,5,6,7) )), |
---|
181 | |
---|
182 | SYNC_PROVISION_ALLOWHTMLEMAIL => array ( self::STREAMER_VAR => "allowhtmlemail", |
---|
183 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )), |
---|
184 | |
---|
185 | SYNC_PROVISION_MAXEMAILAGEFILTER => array ( self::STREAMER_VAR => "maxemailagefilter", |
---|
186 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_CMPHIGHER => -1, |
---|
187 | self::STREAMER_CHECK_CMPLOWER => 6 )), |
---|
188 | |
---|
189 | SYNC_PROVISION_MAXEMAILBODYTRUNCSIZE => array ( self::STREAMER_VAR => "maxemailbodytruncsize", |
---|
190 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_CMPHIGHER => -2 )), |
---|
191 | |
---|
192 | SYNC_PROVISION_MAXEMAILHTMLBODYTRUNCSIZE => array ( self::STREAMER_VAR => "maxemailhtmlbodytruncsize", |
---|
193 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_CMPHIGHER => -2 )), |
---|
194 | |
---|
195 | SYNC_PROVISION_REQSIGNEDSMIMEMESSAGES => array ( self::STREAMER_VAR => "reqsignedsmimemessages", |
---|
196 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )), |
---|
197 | |
---|
198 | SYNC_PROVISION_REQENCSMIMEMESSAGES => array ( self::STREAMER_VAR => "reqencsmimemessages", |
---|
199 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )), |
---|
200 | |
---|
201 | SYNC_PROVISION_REQSIGNEDSMIMEALGORITHM => array ( self::STREAMER_VAR => "reqsignedsmimealgorithm", |
---|
202 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )), |
---|
203 | |
---|
204 | SYNC_PROVISION_REQENCSMIMEALGORITHM => array ( self::STREAMER_VAR => "reqencsmimealgorithm", |
---|
205 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1,2,3,4) )), |
---|
206 | |
---|
207 | SYNC_PROVISION_ALLOWSMIMEENCALGORITHNEG => array ( self::STREAMER_VAR => "allowsmimeencalgneg", |
---|
208 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1,2) )), |
---|
209 | |
---|
210 | SYNC_PROVISION_ALLOWSMIMESOFTCERTS => array ( self::STREAMER_VAR => "allowsmimesoftcerts", |
---|
211 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )), |
---|
212 | |
---|
213 | SYNC_PROVISION_ALLOWBROWSER => array ( self::STREAMER_VAR => "allowbrowser", |
---|
214 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )), |
---|
215 | |
---|
216 | SYNC_PROVISION_ALLOWCONSUMEREMAIL => array ( self::STREAMER_VAR => "allowconsumeremail", |
---|
217 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )), |
---|
218 | |
---|
219 | SYNC_PROVISION_ALLOWREMOTEDESKTOP => array ( self::STREAMER_VAR => "allowremotedesk", |
---|
220 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )), |
---|
221 | |
---|
222 | SYNC_PROVISION_ALLOWINTERNETSHARING => array ( self::STREAMER_VAR => "allowinternetsharing", |
---|
223 | self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )), |
---|
224 | |
---|
225 | SYNC_PROVISION_UNAPPROVEDINROMAPPLIST => array ( self::STREAMER_VAR => "unapprovedinromapplist", |
---|
226 | self::STREAMER_PROP => self::STREAMER_TYPE_SEND_EMPTY, |
---|
227 | self::STREAMER_ARRAY => SYNC_PROVISION_APPNAME), //TODO check |
---|
228 | |
---|
229 | SYNC_PROVISION_APPROVEDAPPLIST => array ( self::STREAMER_VAR => "approvedapplist", |
---|
230 | self::STREAMER_PROP => self::STREAMER_TYPE_SEND_EMPTY, |
---|
231 | self::STREAMER_ARRAY => SYNC_PROVISION_HASH), //TODO check |
---|
232 | ); |
---|
233 | } |
---|
234 | |
---|
235 | parent::SyncObject($mapping); |
---|
236 | } |
---|
237 | |
---|
238 | public function Load($policies = array()) { |
---|
239 | if (empty($policies)) { |
---|
240 | $this->LoadDefaultPolicies(); |
---|
241 | } |
---|
242 | else foreach ($policies as $p=>$v) { |
---|
243 | if (!isset($this->mapping[$p])) { |
---|
244 | ZLog::Write(LOGLEVEL_INFO, sprintf("Policy '%s' not supported by the device, ignoring", substr($p, strpos($p,':')+1))); |
---|
245 | continue; |
---|
246 | } |
---|
247 | ZLog::Write(LOGLEVEL_INFO, sprintf("Policy '%s' enforced with: %s", substr($p, strpos($p,':')+1), Utils::PrintAsString($v))); |
---|
248 | |
---|
249 | $var = $this->mapping[$p][self::STREAMER_VAR]; |
---|
250 | $this->$var = $v; |
---|
251 | } |
---|
252 | } |
---|
253 | |
---|
254 | public function LoadDefaultPolicies() { |
---|
255 | //AS 12.0, 12.1 and 14.0 props |
---|
256 | $this->devpwenabled = 0; |
---|
257 | $this->alphanumpwreq = 0; |
---|
258 | $this->devencenabled = 0; |
---|
259 | $this->pwrecoveryenabled = 0; |
---|
260 | $this->docbrowseenabled; |
---|
261 | $this->attenabled = 1; |
---|
262 | $this->mindevpwlenngth = 4; |
---|
263 | $this->maxinacttimedevlock = 900; |
---|
264 | $this->maxdevpwfailedattempts = 8; |
---|
265 | $this->maxattsize = ''; |
---|
266 | $this->allowsimpledevpw = 1; |
---|
267 | $this->devpwexpiration = 0; |
---|
268 | $this->devpwhistory = 0; |
---|
269 | |
---|
270 | //AS 12.1 and 14.0 props |
---|
271 | $this->allostoragecard = 1; |
---|
272 | $this->allowcam = 1; |
---|
273 | $this->reqdevenc = 0; |
---|
274 | $this->allowunsignedapps = 1; |
---|
275 | $this->allowunsigninstallpacks = 1; |
---|
276 | $this->mindevcomplexchars = 3; |
---|
277 | $this->allowwifi = 1; |
---|
278 | $this->allowtextmessaging = 1; |
---|
279 | $this->allowpopimapemail = 1; |
---|
280 | $this->allowbluetooth = 2; |
---|
281 | $this->allowirda = 1; |
---|
282 | $this->reqmansyncroam = 0; |
---|
283 | $this->allowdesktopsync = 1; |
---|
284 | $this->maxcalagefilter = 0; |
---|
285 | $this->allowhtmlemail = 1; |
---|
286 | $this->maxemailagefilter = 0; |
---|
287 | $this->maxemailbodytruncsize = -1; |
---|
288 | $this->maxemailhtmlbodytruncsize = -1; |
---|
289 | $this->reqsignedsmimemessages = 0; |
---|
290 | $this->reqencsmimemessages = 0; |
---|
291 | $this->reqsignedsmimealgorithm = 0; |
---|
292 | $this->reqencsmimealgorithm = 0; |
---|
293 | $this->allowsmimeencalgneg = 2; |
---|
294 | $this->allowsmimesoftcerts = 1; |
---|
295 | $this->allowbrowser = 1; |
---|
296 | $this->allowconsumeremail = 1; |
---|
297 | $this->allowremotedesk = 1; |
---|
298 | $this->allowinternetsharing = 1; |
---|
299 | $this->unapprovedinromapplist = array(); |
---|
300 | $this->approvedapplist = array(); |
---|
301 | } |
---|
302 | } |
---|
303 | |
---|
304 | ?> |
---|