CCrmRestProxyBase::getWebDavSettings

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmRestProxyBase
  4. getWebDavSettings
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/restservice.php
  • Класс: \CCrmRestProxyBase
  • Вызов: CCrmRestProxyBase::getWebDavSettings
protected function getWebDavSettings()
{
	if($this->webdavSettings !== null)
	{
		return $this->webdavSettings;
	}

	if(!CModule::IncludeModule('webdav'))
	{
		throw new RestException('Could not load webdav module.');
	}

	$opt = COption::getOptionString('webdav', 'user_files', null);
	if($opt == null)
	{
		throw new RestException('Could not find webdav settings.');
	}

	$user = CCrmSecurityHelper::GetCurrentUser();

	$opt = unserialize($opt, ['allowed_classes' => false]);
	$iblockID = intval($opt[CSite::GetDefSite()]['id']);
	$userSectionID = CWebDavIblock::getRootSectionIdForUser($iblockID, $user->GetID());
	if(!is_numeric($userSectionID) || $userSectionID <= 0)
	{
		throw new RestException('Could not find webdav section for user '.$user->GetLastName().'.');
	}

	return ($this->webdavSettings =
		array(
			'IBLOCK_ID' => $iblockID,
			'IBLOCK_SECTION_ID' => intval($userSectionID),
		)
	);
}

Добавить комментарий