CAllCrmQuote::RebuildEntityAccessAttrs

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CAllCrmQuote
  4. RebuildEntityAccessAttrs
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_quote.php
  • Класс: \CAllCrmQuote
  • Вызов: CAllCrmQuote::RebuildEntityAccessAttrs
public function RebuildEntityAccessAttrs($IDs)
{
	if(!is_array($IDs))
	{
		$IDs = array($IDs);
	}

	$dbResult = self::GetList(
		array(),
		array('@ID' => $IDs, 'CHECK_PERMISSIONS' => 'N'),
		false,
		false,
		array('ID', 'ASSIGNED_BY_ID', 'OPENED', 'STATUS_ID')
	);

	if(!is_object($dbResult))
	{
		return;
	}

	while($fields = $dbResult->Fetch())
	{
		$ID = intval($fields['ID']);
		$assignedByID = isset($fields['ASSIGNED_BY_ID']) ? intval($fields['ASSIGNED_BY_ID']) : 0;
		if($assignedByID <= 0)
		{
			continue;
		}

		$attrs = [];
		if(isset($fields['OPENED']))
		{
			$attrs['OPENED'] = $fields['OPENED'];
		}

		if(isset($fields['STATUS_ID']))
		{
			$attrs['STATUS_ID'] = $fields['STATUS_ID'];
		}

		$entityAttrs = self::BuildEntityAttr($assignedByID, $attrs);
		$securityRegisterOptions = (new \Bitrix\Crm\Security\Controller\RegisterOptions())
			->setEntityAttributes($arEntityAttr)
			->setEntityFields($fields)
		;
		Crm\Security\Manager::getEntityController(CCrmOwnerType::Quote)
			->register(self::$TYPE_NAME, $ID, $securityRegisterOptions)
		;
	}
}

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