• Модуль: rest
  • Путь к файлу: ~/bitrix/modules/rest/classes/general/rest_util.php
  • Класс: CRestUtil
  • Вызов: CRestUtil::canInstallApplication
static function canInstallApplication($appInfo = null, ?int $userId = null)
{
	global $USER;

	if (
		!empty($appInfo['HOLD_INSTALL_BY_TRIAL'])
		&& $appInfo['HOLD_INSTALL_BY_TRIAL'] === 'Y'
		&& BitrixRestMarketplaceClient::isSubscriptionDemo()
	)
	{
		return false;
	}

	if (static::isAdmin($userId))
	{
		return true;
	}

	if (
		is_array($appInfo)
		&& $appInfo['TYPE'] === BitrixRestAppTable::TYPE_CONFIGURATION
		&& !empty($appInfo['MANIFEST']['CODE'])
	)
	{
		$access = BitrixRestConfigurationManifest::checkAccess(
			BitrixRestConfigurationManifest::ACCESS_TYPE_IMPORT,
			$appInfo['MANIFEST']['CODE']
		);

		return $access['result'];
	}

	$hasAccess = $USER->CanAccess(static::getInstallAccessList());
	if ($hasAccess && is_array($appInfo))
	{
		return static::appCanBeInstalledByUser($appInfo);
	}

	return $hasAccess;
}