• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/integration/ui/entityselector/recentchatprovider.php
  • Класс: BitrixImIntegrationUIEntitySelectorRecentChatProvider
  • Вызов: RecentChatProvider::getEntityTypeByUser
static function getEntityTypeByUser(array $user): string
{
	if (!$user['ACTIVE'])
	{
		$type = 'inactive';
	}
	else if ($user['EXTERNAL_AUTH_ID'] === 'email')
	{
		$type = 'email';
	}
	else if ($user['EXTERNAL_AUTH_ID'] === 'replica')
	{
		$type = 'network';
	}
	else if (!in_array($user['EXTERNAL_AUTH_ID'], UserTable::getExternalUserTypes(), true))
	{
		if (ModuleManager::isModuleInstalled('intranet'))
		{
			if (UserProvider::isIntegrator($user['ID']))
			{
				$type = 'integrator';
			}
			else
			{
				$ufDepartment = $user['DEPARTMENTS'];
				if (
					empty($ufDepartment)
					|| (
						is_array($ufDepartment)
						&& count($ufDepartment) === 1
						&& (int)$ufDepartment[0] === 0
					)
				)
				{
					$type = 'extranet';
				}
				else
				{
					$type = 'employee';
				}
			}
		}
		else
		{
			$type = 'user';
		}
	}
	else
	{
		$type = 'unknown';
	}

	return $type;
}