Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
checkaccesstrait.php
1<?php
2
4
9
13trait CheckAccessTrait
14{
20 protected function hasAccessToCatalog(): bool
21 {
22 if (!Loader::includeModule('catalog'))
23 {
24 return true;
25 }
26
27 $iblockId = (int)($this->arResult['userField']['SETTINGS']['IBLOCK_ID'] ?? 0);
28 if ($iblockId <= 0)
29 {
30 return true;
31 }
32
33 $iblockIsCatalog = !empty(CatalogIblockTable::getByPrimary($iblockId)->fetch());
34 if (!$iblockIsCatalog)
35 {
36 return true;
37 }
38
39 return AccessController::getCurrent()->check(ActionDictionary::ACTION_CATALOG_READ);
40 }
41}