PullManager::filterUserIdsWhoCanViewItem

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. PullManager
  4. filterUserIdsWhoCanViewItem
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/integration/pullmanager.php
  • Класс: Bitrix\Crm\Integration\PullManager
  • Вызов: PullManager::filterUserIdsWhoCanViewItem
protected function filterUserIdsWhoCanViewItem(array $item, array $userIds, string $eventName): array
{
	$withoutPrefix = str_replace(self::EVENT_KANBAN_UPDATED . '_', '', $eventName);
	$nameParts = (array)explode('_', $withoutPrefix);

	if ($nameParts[0] === 'DYNAMIC' || $nameParts[0] === 'SMART')
	{
		// like 'DYNAMIC_128' or 'SMART_INVOICE'
		$typeName = $nameParts[0] . '_' . $nameParts[1];
	}
	else
	{
		$typeName = $nameParts[0];
	}

	$result = [];

	$entityTypeId = \CCrmOwnerType::ResolveID($typeName);
	if (\CCrmOwnerType::IsEntity($entityTypeId))
	{
		foreach($userIds as $userId)
		{
			$userId = (int)$userId;
			if($userId > 0)
			{
				if (Container::getInstance()->getUserPermissions($userId)->checkReadPermissions(
					$entityTypeId,
					$item['id'],
					$item['data']['categoryId'] ?? null
				))
				{
					$result[$userId] = $userId;
				}
			}
		}
	}

	return $result;
}

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