aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-11-08 16:36:36 -0800
committerredmatrix <redmatrix@redmatrix.me>2015-11-08 16:36:36 -0800
commit5c2692a8ea6de0a5e0ccfa0a2b9508d2d62266c6 (patch)
tree452f3d9b1a81b97b9ab17b6ec71c31c71303f170 /include
parent2536dc39b5e49cf288883fd1f1b1a3fe8db3cbdb (diff)
downloadvolse-hubzilla-5c2692a8ea6de0a5e0ccfa0a2b9508d2d62266c6.tar.gz
volse-hubzilla-5c2692a8ea6de0a5e0ccfa0a2b9508d2d62266c6.tar.bz2
volse-hubzilla-5c2692a8ea6de0a5e0ccfa0a2b9508d2d62266c6.zip
no comment permission bug, also implement delete() in RedDirectory per Waitman
Diffstat (limited to 'include')
-rw-r--r--include/RedDAV/RedDirectory.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/RedDAV/RedDirectory.php b/include/RedDAV/RedDirectory.php
index 87bdf8f13..8d8af5bd3 100644
--- a/include/RedDAV/RedDirectory.php
+++ b/include/RedDAV/RedDirectory.php
@@ -363,6 +363,27 @@ class RedDirectory extends DAV\Node implements DAV\ICollection, DAV\IQuota {
}
/**
+ * @brief delete directory
+ */
+
+ public function delete() {
+ logger('delete file ' . basename($this->red_path), LOGGER_DEBUG);
+
+ if ((! $this->auth->owner_id) || (! perm_is_allowed($this->auth->owner_id, $this->auth->observer, 'write_storage'))) {
+ throw new DAV\Exception\Forbidden('Permission denied.');
+ }
+
+ if ($this->auth->owner_id !== $this->auth->channel_id) {
+ if (($this->auth->observer !== $this->data['creator']) || intval($this->data['is_dir'])) {
+ throw new DAV\Exception\Forbidden('Permission denied.');
+ }
+ }
+
+ attach_delete($this->auth->owner_id, $this->folder_hash);
+ }
+
+
+ /**
* @brief Checks if a child exists.
*
* @param string $name