- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_catalog.php
- Класс: \CAllCrmCatalog
- Вызов: CAllCrmCatalog::setCrmGroupRights
static function setCrmGroupRights($iblockId)
{
$iblockTypeId = self::GetCatalogTypeID();
$crmAdminGroupId = \CCrmSaleHelper::getShopGroupIdByType('admin');
$crmManagerGroupId = \CCrmSaleHelper::getShopGroupIdByType('manager');
if (!empty($crmAdminGroupId))
{
\CIBlockRights::setGroupRight($crmAdminGroupId, $iblockTypeId, 'X', $iblockId);
}
if (!empty($crmManagerGroupId))
{
\CIBlockRights::setGroupRight($crmManagerGroupId, $iblockTypeId, 'W', $iblockId);
}
if (Loader::includeModule('catalog'))
{
$catalog = \CCatalogSku::GetInfoByProductIBlock($iblockId);
if (!empty($catalog))
{
if (!empty($crmAdminGroupId))
{
\CIBlockRights::setGroupRight($crmAdminGroupId, $iblockTypeId, 'X', $catalog['IBLOCK_ID']);
}
if (!empty($crmManagerGroupId))
{
\CIBlockRights::setGroupRight($crmManagerGroupId, $iblockTypeId, 'W', $catalog['IBLOCK_ID']);
}
}
unset($catalog);
}
unset($crmManagerGroupId, $crmAdminGroupId);
unset($iblockTypeId);
}