/** * Get storage * * @return \XLite\Model\Base\Storage */ protected function getStorage() { $storage = parent::getStorage(); if ($storage && $storage instanceof \XLite\Module\CDev\FileAttachments\Model\Product\Attachment\Storage && $storage->getAttachment()->getPrivate()) { $key = \XLite\Core\Request::getInstance()->key; $key = \XLite\Core\Database::getRepo('XLite\\Module\\CDev\\Egoods\\Model\\OrderItem\\PrivateAttachment')->findOneBy(array('downloadKey' => $key)); if (!$key || $key->getAttachment()->getId() != $storage->getAttachment()->getid() || !$key->isAvailable()) { $storage = null; } else { $this->storageKey = $key; } } return $storage; }
/** * Get storage * * @return \XLite\Model\Base\Storage|null */ protected function getStorage() { if ($this->getCapostLinkId()) { // Get storage by a link $this->storage = $this->getCapostStorageByLink(); } else { $this->storage = parent::getStorage(); } if (isset($this->storage) && !$this->checkCapostStorageAccess($this->storage)) { // Unauthorized request $this->storage = null; } return $this->storage; }