CAllCrmCatalog::setCrmGroupRights

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CAllCrmCatalog
  4. setCrmGroupRights
  • Модуль: 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);
}

Добавить комментарий