2016-08-01 19:27:07 +03:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @copyright Copyright (c) 2016, Robin Appelman <robin@icewind.nl>
|
|
|
|
*
|
2017-11-06 17:56:42 +03:00
|
|
|
* @author Lukas Reschke <lukas@statuscode.ch>
|
|
|
|
* @author Robin Appelman <robin@icewind.nl>
|
|
|
|
*
|
|
|
|
* @license GNU AGPL version 3 or any later version
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
2016-08-01 19:27:07 +03:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2017-11-06 17:56:42 +03:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2016-08-01 19:27:07 +03:00
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
2017-11-06 17:56:42 +03:00
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
2019-12-03 21:57:53 +03:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2016-08-01 19:27:07 +03:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace OC\Lockdown\Filesystem;
|
|
|
|
|
|
|
|
use Icewind\Streams\IteratorDirectory;
|
2017-02-08 18:38:00 +03:00
|
|
|
use OC\Files\FileInfo;
|
2016-08-01 19:27:07 +03:00
|
|
|
use OC\Files\Storage\Common;
|
2017-07-19 20:44:10 +03:00
|
|
|
use OCP\Files\Storage\IStorage;
|
2016-08-01 19:27:07 +03:00
|
|
|
|
|
|
|
class NullStorage extends Common {
|
|
|
|
public function __construct($parameters) {
|
|
|
|
parent::__construct($parameters);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getId() {
|
|
|
|
return 'null';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function mkdir($path) {
|
|
|
|
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function rmdir($path) {
|
|
|
|
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function opendir($path) {
|
|
|
|
return new IteratorDirectory([]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function is_dir($path) {
|
|
|
|
return $path === '';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function is_file($path) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function stat($path) {
|
|
|
|
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function filetype($path) {
|
|
|
|
return ($path === '') ? 'dir' : false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function filesize($path) {
|
|
|
|
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function isCreatable($path) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function isReadable($path) {
|
|
|
|
return $path === '';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function isUpdatable($path) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function isDeletable($path) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function isSharable($path) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getPermissions($path) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function file_exists($path) {
|
|
|
|
return $path === '';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function filemtime($path) {
|
|
|
|
return ($path === '') ? time() : false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function file_get_contents($path) {
|
|
|
|
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function file_put_contents($path, $data) {
|
|
|
|
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function unlink($path) {
|
|
|
|
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function rename($path1, $path2) {
|
|
|
|
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function copy($path1, $path2) {
|
|
|
|
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function fopen($path, $mode) {
|
|
|
|
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getMimeType($path) {
|
|
|
|
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function hash($type, $path, $raw = false) {
|
|
|
|
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function free_space($path) {
|
2017-02-08 18:38:00 +03:00
|
|
|
return FileInfo::SPACE_UNKNOWN;
|
2016-08-01 19:27:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public function touch($path, $mtime = null) {
|
|
|
|
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getLocalFile($path) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function hasUpdated($path, $time) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getETag($path) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function isLocal() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDirectDownload($path) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-08-04 18:33:31 +03:00
|
|
|
public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = false) {
|
2016-08-01 19:27:07 +03:00
|
|
|
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
|
|
|
|
}
|
|
|
|
|
2017-07-19 20:44:10 +03:00
|
|
|
public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) {
|
2016-08-01 19:27:07 +03:00
|
|
|
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function test() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getOwner($path) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getCache($path = '', $storage = null) {
|
|
|
|
return new NullCache();
|
|
|
|
}
|
|
|
|
}
|