• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/uf/controller.php
  • Класс: BitrixDiskUfController
  • Вызов: Controller::getStorageByType
private function getStorageByType($type, $storageId)
{
	$storage = null;
	if($type === 'user')
	{
		return Driver::getInstance()->getStorageByUserId($this->getUser()->getId());
	}
	elseif($type === 'group')
	{
		$storage = Storage::loadById($storageId);
		if(!$storage || !$storage->getProxyType() instanceof ProxyTypeGroup)
		{
			$this->errorCollection->add(array(new Error("Invalid storage type {$type}. Is not a group.")));
			return null;
		}
	}
	elseif($type === 'common')
	{
		$storage = Storage::loadById($storageId);
		if(!$storage || !$storage->getProxyType() instanceof ProxyTypeCommon)
		{
			$this->errorCollection->add(array(new Error("Invalid storage type {$type}. Is not a common storage.")));
			return null;
		}
	}

	return $storage;
}