aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/Upload/UploadFolder.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2016-05-12 09:42:40 +0200
committerThomas Müller <DeepDiver1975@users.noreply.github.com>2016-05-12 09:42:40 +0200
commitdd9ee10bc0699e5dcc17c3ef2181dcda01d9a69b (patch)
tree2d464fcc20ea330481e56487287aeae462ce5917 /apps/dav/lib/Upload/UploadFolder.php
parent4a3311f430ec6e45c62b2ebde2cae71e943f3c81 (diff)
downloadnextcloud-server-dd9ee10bc0699e5dcc17c3ef2181dcda01d9a69b.tar.gz
nextcloud-server-dd9ee10bc0699e5dcc17c3ef2181dcda01d9a69b.zip
Move dav app to PSR-4 (#24527)
* Move Application to correct namespace and PSR-4 it * Move dav app to PSR-4
Diffstat (limited to 'apps/dav/lib/Upload/UploadFolder.php')
-rw-r--r--apps/dav/lib/Upload/UploadFolder.php61
1 files changed, 61 insertions, 0 deletions
diff --git a/apps/dav/lib/Upload/UploadFolder.php b/apps/dav/lib/Upload/UploadFolder.php
new file mode 100644
index 00000000000..01fbf1f8dc9
--- /dev/null
+++ b/apps/dav/lib/Upload/UploadFolder.php
@@ -0,0 +1,61 @@
+<?php
+
+namespace OCA\DAV\Upload;
+
+use OCA\DAV\Connector\Sabre\Directory;
+use Sabre\DAV\Exception\Forbidden;
+use Sabre\DAV\ICollection;
+
+class UploadFolder implements ICollection {
+
+ private $node;
+
+ function __construct(Directory $node) {
+ $this->node = $node;
+ }
+
+ function createFile($name, $data = null) {
+ // TODO: verify name - should be a simple number
+ $this->node->createFile($name, $data);
+ }
+
+ function createDirectory($name) {
+ throw new Forbidden('Permission denied to create file (filename ' . $name . ')');
+ }
+
+ function getChild($name) {
+ if ($name === '.file') {
+ return new FutureFile($this->node, '.file');
+ }
+ return $this->node->getChild($name);
+ }
+
+ function getChildren() {
+ $children = $this->node->getChildren();
+ $children[] = new FutureFile($this->node, '.file');
+ return $children;
+ }
+
+ function childExists($name) {
+ if ($name === '.file') {
+ return true;
+ }
+ return $this->node->childExists($name);
+ }
+
+ function delete() {
+ $this->node->delete();
+ }
+
+ function getName() {
+ return $this->node->getName();
+ }
+
+ function setName($name) {
+ throw new Forbidden('Permission denied to rename this folder');
+ }
+
+ function getLastModified() {
+ return $this->node->getLastModified();
+ }
+}