aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib/sharedstorage.php
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-05-27 11:05:31 +0200
committerRobin Appelman <icewind@owncloud.com>2014-06-06 09:55:59 +0200
commitbf5e9357fc5dacc0bc951e7c60fe7105533a56fb (patch)
treeb61d8f542b92dd11e1cffdd59bee90272482890c /apps/files_sharing/lib/sharedstorage.php
parenta66c2e6a4757b5d97e120897df1085e4410b279a (diff)
downloadnextcloud-server-bf5e9357fc5dacc0bc951e7c60fe7105533a56fb.tar.gz
nextcloud-server-bf5e9357fc5dacc0bc951e7c60fe7105533a56fb.zip
don't allow to share single files with delete permissions, user should only be possible to unshare a single file but never to delete it
Diffstat (limited to 'apps/files_sharing/lib/sharedstorage.php')
-rw-r--r--apps/files_sharing/lib/sharedstorage.php23
1 files changed, 21 insertions, 2 deletions
diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php
index 2418b830cbc..c5b5060893a 100644
--- a/apps/files_sharing/lib/sharedstorage.php
+++ b/apps/files_sharing/lib/sharedstorage.php
@@ -128,7 +128,18 @@ class Shared extends \OC\Files\Storage\Common {
return false;
}
+ /**
+ * Delete the directory if DELETE permission is granted
+ * @param string $path
+ * @return boolean
+ */
public function rmdir($path) {
+
+ // never delete a share mount point
+ if(empty($path)) {
+ return false;
+ }
+
if (($source = $this->getSourcePath($path)) && $this->isDeletable($path)) {
list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source);
return $storage->rmdir($internalPath);
@@ -256,9 +267,17 @@ class Shared extends \OC\Files\Storage\Common {
return false;
}
+ /**
+ * Delete the file if DELETE permission is granted
+ * @param string $path
+ * @return boolean
+ */
public function unlink($path) {
- // Delete the file if DELETE permission is granted
- $path = ($path === false) ? '' : $path;
+
+ // never delete a share mount point
+ if (empty($path)) {
+ return false;
+ }
if ($source = $this->getSourcePath($path)) {
if ($this->isDeletable($path)) {
list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source);