• Модуль: webdav
  • Путь к файлу: ~/bitrix/modules/webdav/classes/diskdispatcher.php
  • Класс: CWebDavDiskDispatcher
  • Вызов: CWebDavDiskDispatcher::getUserStorageId
protected function getUserStorageId()
{
	if($this->enableDiskModule)
	{
		$storage = BitrixDiskDriver::getInstance()->getStorageByUserId($this->getUser()->getId());
		if(!$storage)
		{
			$storage = BitrixDiskDriver::getInstance()->addUserStorage($this->getUser()->getId());
		}
		if($storage)
		{
			return array(
				'IBLOCK_ID' => $storage->getId(),
				'IBLOCK_SECTION_ID' => $storage->getRootObjectId(),
			);
		}
	}
	$userFilesOptions = COption::getOptionString('webdav', 'user_files', null);
	if($userFilesOptions == null)
	{
		throw new Exception('Where are options "user_files"?');
	}
	$userFilesOptions = unserialize($userFilesOptions, ['allowed_classes' => false]);
	$iblockId = $userFilesOptions[CSite::getDefSite()]['id'];
	$userSectionId = CWebDavIblock::getRootSectionIdForUser($iblockId, $this->getUser()->getId());
	if(!$userSectionId)
	{
		throw new Exception('Wrong section for user ' . $this->getUser()->getLastName());
	}

	return array(
		'IBLOCK_ID' => $iblockId,
		'IBLOCK_SECTION_ID' => $userSectionId,
	);
}