Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
checker.php
1<?php
9
15
16Loc::loadMessages(__FILE__);
17
23{
29 public static function getReadPermissionChecker()
30 {
31 return array(__CLASS__, 'onReadPermissionCheck');
32 }
33
40 public static function onReadPermissionCheck(Result $result)
41 {
42 if (Security\User::current()->canView())
43 {
44 return;
45 }
46
47 $result->addError(new Error(Loc::getMessage('SENDER_COMMON_AJAX_CHECKER_ERROR_NO_READ_ACCESS')));
48 }
49
55 public static function getWritePermissionChecker()
56 {
57 return array(__CLASS__, 'onWritePermissionCheck');
58 }
59
66 public static function onWritePermissionCheck(Result $result)
67 {
68 if (Security\User::current()->canEdit())
69 {
70 return;
71 }
72
73 $result->addError(new Error(Loc::getMessage('SENDER_COMMON_AJAX_CHECKER_ERROR_NO_WRITE_ACCESS')));
74 }
75
81 public static function getViewLetterPermissionChecker()
82 {
83 return function (Result $result)
84 {
85 if (Security\Access::getInstance()->canViewLetters())
86 {
87 return;
88 }
89
90 $result->addError(new Error(Loc::getMessage('SENDER_COMMON_AJAX_CHECKER_ERROR_NO_READ_ACCESS')));
91 };
92 }
93
99 public static function getModifyLetterPermissionChecker()
100 {
101 return function (Result $result)
102 {
103 if (Security\Access::getInstance()->canModifyLetters())
104 {
105 return;
106 }
107
108 $result->addError(new Error(Loc::getMessage('SENDER_COMMON_AJAX_CHECKER_ERROR_NO_WRITE_ACCESS')));
109 };
110 }
111
117 public static function getModifyAbusePermissionChecker()
118 {
119 return function (Result $result)
120 {
121 if (Security\Access::getInstance()->canModifyAbuses())
122 {
123 return;
124 }
125
126 $result->addError(new Error(Loc::getMessage('SENDER_COMMON_AJAX_CHECKER_ERROR_NO_WRITE_ACCESS')));
127 };
128 }
129
135 public static function getViewSegmentPermissionChecker()
136 {
137 return function (Result $result)
138 {
139 if (Security\Access::getInstance()->canViewSegments())
140 {
141 return;
142 }
143
144 $result->addError(new Error(Loc::getMessage('SENDER_COMMON_AJAX_CHECKER_ERROR_NO_READ_ACCESS')));
145 };
146 }
147
153 public static function getSelectSegmentPermissionChecker()
154 {
155 return function (Result $result)
156 {
157 if (Security\Access::getInstance()->canViewSegments())
158 {
159 return;
160 }
161 if (Security\Access::getInstance()->canViewLetters())
162 {
163 return;
164 }
165 if (Security\Access::getInstance()->canViewAds())
166 {
167 return;
168 }
169 if (Security\Access::getInstance()->canViewRc())
170 {
171 return;
172 }
173 if (Security\Access::getInstance()->canModifySettings())
174 {
175 return;
176 }
177
178 $result->addError(new Error(Loc::getMessage('SENDER_COMMON_AJAX_CHECKER_ERROR_NO_READ_ACCESS')));
179 };
180 }
181
187 public static function getModifySegmentPermissionChecker()
188 {
189 return function (Result $result)
190 {
191 if (Security\Access::getInstance()->canModifySegments())
192 {
193 return;
194 }
195
196 $result->addError(new Error(Loc::getMessage('SENDER_COMMON_AJAX_CHECKER_ERROR_NO_WRITE_ACCESS')));
197 };
198 }
199
205 public static function getViewRcPermissionChecker()
206 {
207 return function (Result $result)
208 {
209 if (Security\Access::getInstance()->canViewRc())
210 {
211 return;
212 }
213
214 $result->addError(new Error(Loc::getMessage('SENDER_COMMON_AJAX_CHECKER_ERROR_NO_READ_ACCESS')));
215 };
216 }
217
223 public static function getModifyRcPermissionChecker()
224 {
225 return function (Result $result)
226 {
227 if (Security\Access::getInstance()->canModifyRc())
228 {
229 return;
230 }
231
232 $result->addError(new Error(Loc::getMessage('SENDER_COMMON_AJAX_CHECKER_ERROR_NO_WRITE_ACCESS')));
233 };
234 }
235
241 public static function getViewBlacklistPermissionChecker()
242 {
243 return function (Result $result)
244 {
245 if (Security\Access::getInstance()->canViewBlacklist())
246 {
247 return;
248 }
249
250 $result->addError(new Error(Loc::getMessage('SENDER_COMMON_AJAX_CHECKER_ERROR_NO_READ_ACCESS')));
251 };
252 }
253
259 public static function getModifyBlacklistPermissionChecker()
260 {
261 return function (Result $result)
262 {
263 if (Security\Access::getInstance()->canModifyBlacklist())
264 {
265 return;
266 }
267
268 $result->addError(new Error(Loc::getMessage('SENDER_COMMON_AJAX_CHECKER_ERROR_NO_WRITE_ACCESS')));
269 };
270 }
271
277 public static function getViewAdPermissionChecker()
278 {
279 return function (Result $result)
280 {
281 if (Security\Access::getInstance()->canViewAds())
282 {
283 return;
284 }
285
286 $result->addError(new Error(Loc::getMessage('SENDER_COMMON_AJAX_CHECKER_ERROR_NO_READ_ACCESS')));
287 };
288 }
289
295 public static function getModifyAdPermissionChecker()
296 {
297 return function (Result $result)
298 {
299 if (Security\Access::getInstance()->canModifyAds())
300 {
301 return;
302 }
303
304 $result->addError(new Error(Loc::getMessage('SENDER_COMMON_AJAX_CHECKER_ERROR_NO_WRITE_ACCESS')));
305 };
306 }
307
313 public static function getViewRecipientsPermissionChecker()
314 {
315 return function (Result $result)
316 {
317 if (Security\Access::getInstance()->canViewSegments())
318 {
319 return;
320 }
321
322 $result->addError(new Error(Loc::getMessage('SENDER_COMMON_AJAX_CHECKER_ERROR_NO_READ_ACCESS')));
323 };
324 }
325
332 {
333 return function (Result $result)
334 {
335 if (Security\Access::getInstance()->canModifySegments())
336 {
337 return;
338 }
339
340 $result->addError(new Error(Loc::getMessage('SENDER_COMMON_AJAX_CHECKER_ERROR_NO_WRITE_ACCESS')));
341 };
342 }
343
349 public static function getModifySettingsPermissionChecker()
350 {
351 return function (Result $result)
352 {
353 if (Security\Access::getInstance()->canModifySettings())
354 {
355 return;
356 }
357
358 $result->addError(new Error(Loc::getMessage('SENDER_COMMON_AJAX_CHECKER_ERROR_NO_WRITE_ACCESS')));
359 };
360 }
361
367 {
368 return function (Result $result)
369 {
370 if (Security\Access::getInstance()->canPauseStartStopLetter())
371 {
372 return;
373 }
374
375 $result->addError(new Error(Loc::getMessage('SENDER_COMMON_AJAX_CHECKER_ERROR_NO_WRITE_ACCESS')));
376 };
377 }
378
384 {
385 return function (Result $result)
386 {
387 if (Security\Access::getInstance()->canPauseStartStopAds())
388 {
389 return;
390 }
391
392 $result->addError(new Error(Loc::getMessage('SENDER_COMMON_AJAX_CHECKER_ERROR_NO_WRITE_ACCESS')));
393 };
394 }
395
401 {
402 return function (Result $result)
403 {
404 if (Security\Access::getInstance()->canPauseStartStopRc())
405 {
406 return;
407 }
408
409 $result->addError(new Error(Loc::getMessage('SENDER_COMMON_AJAX_CHECKER_ERROR_NO_WRITE_ACCESS')));
410 };
411 }
412
417 public static function getModifyTemplatePermissionChecker()
418 {
419 return function (Result $result)
420 {
421 if (Security\Access::getInstance()->canModifyTemplates())
422 {
423 return;
424 }
425
426 $result->addError(new Error(Loc::getMessage('SENDER_COMMON_AJAX_CHECKER_ERROR_NO_WRITE_ACCESS')));
427 };
428 }
429}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29
static onReadPermissionCheck(Result $result)
Definition checker.php:40
static onWritePermissionCheck(Result $result)
Definition checker.php:66