• Модуль: rest
  • Путь к файлу: ~/bitrix/modules/rest/lib/engine/scopemanager.php
  • Класс: BitrixRestEngineScopeManager
  • Вызов: ScopeManager::load
private function load() : bool
{
	$this->scopeList = [];
	$cache = Cache::createInstance();
	if ($cache->initCache(self::CACHE_TIME, self::CACHE_KEY, self::CACHE_DIR))
	{
		$this->scopeList = $cache->getVars();
	}
	elseif ($cache->startDataCache())
	{
		$provider = new CRestProvider();
		$scopeList = $provider->getDescription();
		foreach ($scopeList as $code => $value)
		{
			$this->scopeList[$code] = $code;
		}

		$installedModuleList = ModuleManager::getInstalledModules();
		foreach ($installedModuleList as $moduleId => $moduleDescription)
		{
			if (!isset($description[$moduleId]))
			{
				$controllersConfig = Configuration::getInstance($moduleId);

				if (!empty($controllersConfig['controllers']['restIntegration']['enabled']))
				{
					if (
						!isset($controllersConfig['controllers']['restIntegration']['hideModuleScope'])
						|| !$controllersConfig['controllers']['restIntegration']['hideModuleScope']
					)
					{
						$this->scopeList[$moduleId] = $moduleId;
					}

					if (
						isset($controllersConfig['controllers']['restIntegration']['scopes'])
						&& is_array($controllersConfig['controllers']['restIntegration']['scopes'])
					)
					{
						$this->scopeList = array_merge(
							$this->scopeList,
							array_fill_keys(
								$controllersConfig['controllers']['restIntegration']['scopes'],
								$moduleId
							)
						);
					}
				}
			}
		}

		unset($this->scopeList[CRestUtil::GLOBAL_SCOPE]);

		$cache->endDataCache($this->scopeList);
	}

	return true;
}