Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
checkaccesstrait.php
1
<?php
2
3
namespace
Bitrix\Iblock\Component\UserField\Catalog
;
4
5
use
Bitrix\Catalog\Access\AccessController
;
6
use
Bitrix\Catalog\Access\ActionDictionary
;
7
use
Bitrix\Catalog\CatalogIblockTable
;
8
use
Bitrix\Main\Loader
;
9
13
trait 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
}
Bitrix\Catalog\Access\AccessController
Definition
AccessController.php:28
Bitrix\Catalog\Access\ActionDictionary
Definition
ActionDictionary.php:17
Bitrix\Catalog\CatalogIblockTable
Definition
catalogiblock.php:41
Bitrix\Main\Loader
Definition
loader.php:12
Bitrix\Iblock\Component\UserField\Catalog
Definition
checkaccesstrait.php:3
modules
iblock
lib
component
userfield
catalog
checkaccesstrait.php
Создано системой
1.10.0