• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/uf/controller.php
  • Класс: BitrixDiskUfController
  • Вызов: Controller::processActionGetFolderForSavedFiles
protected function processActionGetFolderForSavedFiles()
{
	$storage = Driver::getInstance()->getStorageByUserId($this->getUser()->getId());
	if(!$storage)
	{
		$this->errorCollection[] = new Error(
			"Could not find storage for user id {$this->getUser()->getId()}",
			self::ERROR_COULD_NOT_FIND_STORAGE
		);
		$this->sendJsonErrorResponse();
	}

	$securityContext = $storage->getCurrentUserSecurityContext();

	$folder = $storage->getFolderForSavedFiles();
	if(!$folder)
	{
		$this->errorCollection[] = new Error(
			Loc::getMessage('DISK_UF_CONTROLLER_ERROR_COULD_NOT_FIND_FIND_FOLDER'),
			self::ERROR_COULD_NOT_FIND_FOLDER
		);
		$this->sendJsonErrorResponse();
	}

	if(!$folder->canAdd($securityContext))
	{
		$this->sendJsonAccessDeniedResponse();
	}

	$this->sendJsonResponse(array(
		'id' => $folder->getId(),
		'storageId' => $folder->getStorageId(),
		'type' => 'folder',
		'name' => $folder->getName(),
	));
}