diff options
author | Michael Gapczynski <GapczynskiM@gmail.com> | 2011-07-31 15:02:59 -0400 |
---|---|---|
committer | Michael Gapczynski <GapczynskiM@gmail.com> | 2011-07-31 15:02:59 -0400 |
commit | a14a83b9c69d6b03fa8b5a2ef4c83799d37106b8 (patch) | |
tree | b3987298d97f3b2a2116a108a7f9776fa8d11c37 /apps/files_sharing/sharedstorage.php | |
parent | c185743ae9e04f1bc6500ec570c40e9781fb4512 (diff) | |
download | nextcloud-server-a14a83b9c69d6b03fa8b5a2ef4c83799d37106b8.tar.gz nextcloud-server-a14a83b9c69d6b03fa8b5a2ef4c83799d37106b8.zip |
Fix delTree(), it shouldn't be passed to the local storage provider unless the user has delete permission
Diffstat (limited to 'apps/files_sharing/sharedstorage.php')
-rw-r--r-- | apps/files_sharing/sharedstorage.php | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/apps/files_sharing/sharedstorage.php b/apps/files_sharing/sharedstorage.php index c819c6dd70b..11b141373c4 100644 --- a/apps/files_sharing/sharedstorage.php +++ b/apps/files_sharing/sharedstorage.php @@ -402,10 +402,6 @@ class OC_Filestorage_Shared extends OC_Filestorage { OC_Share::setTarget($target, "/"); } else { OC_Share::pullOutOfFolder($target, "/"); - // If this is a folder being deleted, call setTarget in case there are any database entries inside the folder - if (self::is_dir($path)) { - OC_Share::setTarget($target, "/"); - } } // Delete the database entry } else { @@ -440,8 +436,8 @@ class OC_Filestorage_Shared extends OC_Filestorage { } $this->clearFolderSizeCache($this->getInternalPath($oldTarget)); $this->clearFolderSizeCache($this->getInternalPath($newTarget)); + return true; } - return true; } public function copy($path1, $path2) { @@ -502,10 +498,30 @@ class OC_Filestorage_Shared extends OC_Filestorage { } public function delTree($path) { - $source = $this->getSource($path); - if ($source) { - $storage = OC_Filesystem::getStorage($source); - return $storage->delTree($this->getInternalPath($source)); + $target = $this->datadir.$path; + if (OC_Share::getPermissions($target) & OC_Share::DELETE) { + $source = $this->getSource($path); + if ($source) { + $storage = OC_Filesystem::getStorage($source); + return $storage->delTree($this->getInternalPath($source)); + } + } else { + // Check if the folder is inside a shared folder + if (OC_Share::getParentFolders($target)) { + // If entry for folder already exists + if (OC_Share::getItem($target)) { + OC_Share::setTarget($target, "/"); + } else { + OC_Share::pullOutOfFolder($target, "/"); + // Call setTarget in case there are any database entries for items inside this folder + OC_Share::setTarget($target, "/"); + } + // Delete the database entry + } else { + OC_Share::unshareFromMySelf($target); + } + $this->clearFolderSizeCache($this->getInternalPath($target)); + return true; } } |