• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/controller/userfieldconfig.php
  • Класс: BitrixMainControllerUserFieldConfig
  • Вызов: UserFieldConfig::getAccess
protected function getAccess(string $moduleId, ?CRestServer $restServer = null): ?UserFieldAccess
{
	try
	{
		$access = UserFieldAccess::getInstance($moduleId);
	}
	catch (ObjectNotFoundException $e)
	{
		if ($restServer)
		{
			$this->addError(new Error($e->getMessage()));

			return null;
		}

		throw $e;
	}

	if ($restServer)
	{
		$scopes = $restServer->getAuthScope();
		if (!in_array($moduleId, $scopes, true))
		{
			$this->addError(
				new Error(
					'The current method required more scopes. (' . $moduleId . ')',
					BitrixRestEngineActionFilterScope::ERROR_INSUFFICIENT_SCOPE
				)
			);

			return null;
		}
	}

	return $access;
}