summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMichael Gapczynski <GapczynskiM@gmail.com>2011-08-17 22:10:25 -0400
committerMichael Gapczynski <GapczynskiM@gmail.com>2011-08-17 22:10:25 -0400
commit8fb75f379a8fb155f4d36233864e4e62e21d538b (patch)
tree4a8c715a0430cf314104d403ee82f1fc5cf49e10 /apps
parentb4cf61ee324bb5b82710f344dfd5a97ac3234e10 (diff)
downloadnextcloud-server-8fb75f379a8fb155f4d36233864e4e62e21d538b.tar.gz
nextcloud-server-8fb75f379a8fb155f4d36233864e4e62e21d538b.zip
Comment rename() and prevent trying to move items if the user doesn't have write permission
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/sharedstorage.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/apps/files_sharing/sharedstorage.php b/apps/files_sharing/sharedstorage.php
index c3e75c8f1e5..695fe3160ab 100644
--- a/apps/files_sharing/sharedstorage.php
+++ b/apps/files_sharing/sharedstorage.php
@@ -423,8 +423,10 @@ class OC_Filestorage_Shared extends OC_Filestorage {
if ($folders = OC_Share::getParentFolders($oldTarget)) {
$root1 = substr($path1, 0, strpos($path1, "/"));
$root2 = substr($path1, 0, strpos($path2, "/"));
+ // Prevent items from being moved into different shared folders until versioning (cut and paste) and prevent items going into 'Shared'
if ($root1 !== $root2) {
return false;
+ // Check if both paths have write permission
} else if ($this->is_writeable($path1) && $this->is_writeable($path2)) {
$oldSource = $this->getSource($path1);
$newSource = $folders['source'].substr($newTarget, strlen($folders['target']));
@@ -432,6 +434,10 @@ class OC_Filestorage_Shared extends OC_Filestorage {
$storage = OC_Filesystem::getStorage($oldSource);
return $storage->rename($this->getInternalPath($oldSource), $this->getInternalPath($newSource));
}
+ // If the user doesn't have write permission, items can only be renamed and not moved
+ } else if (dirname($path1) !== dirname($path2)) {
+ return false;
+ // The item will be renamed in the database, but won't be touched on the owner's filesystem
} else {
OC_Share::pullOutOfFolder($oldTarget, $newTarget);
// If this is a folder being renamed, call setTarget in case there are any database entries inside the folder