• Модуль: rest
  • Путь к файлу: ~/bitrix/modules/rest/classes/general/restentity.php
  • Класс: CBitrixRestEntity
  • Вызов: CBitrixRestEntity::checkIblockType
static function checkIblockType()
{
	$iblockType = COption::GetOptionString("rest", "entity_iblock_type", "rest_entity");

	$arIBlockTypeData = array(
		'ID' => $iblockType,
		'SECTIONS' => 'Y',
		'IN_RSS' => 'N',
	);

	$obBlocktype = new CIBlockType();
	if($obBlocktype->Add($arIBlockTypeData))
	{
		COption::SetOptionString("rest", "entity_iblock_type", $iblockType);

		$dbRes = CIBlock::GetList(array(), array('TYPE' => $iblockType));

		$taskId = CIBlockRights::LetterToTask('X');

		while ($arIBlock = $dbRes->Fetch())
		{
			$obIBlockRights = new CIBlockRights($arIBlock['ID']);
			$arRights = $obIBlockRights->GetRights();

			foreach($arRights as $key => $arRight)
			{
				if($arRight['GROUP_CODE'] == 'U1')
				{
					unset($arRights[$key]);
				}
			}

			$arRights['n0'] = array(
				'GROUP_CODE' => 'U1',
				'TASK_ID' => $taskId,
				'DO_CLEAN' => 'N',
			);

			$obIBlockRights->SetRights($arRights);
		}
	}
}