diff options
author | Michael Gapczynski <mtgap@owncloud.com> | 2012-09-07 00:01:52 -0400 |
---|---|---|
committer | Michael Gapczynski <mtgap@owncloud.com> | 2012-09-07 00:02:22 -0400 |
commit | 73d726d1b26f011e77761934bcf7f5ce8db86241 (patch) | |
tree | b95913dddcd74b71a97c20ea843d5a4ea23ded16 /apps/files_sharing | |
parent | 17dadd5c8a39f1903ffeec2c2c78e5e6cd145d9c (diff) | |
download | nextcloud-server-73d726d1b26f011e77761934bcf7f5ce8db86241.tar.gz nextcloud-server-73d726d1b26f011e77761934bcf7f5ce8db86241.zip |
Support for unshare from self, with a bunch of temporary fixes to overcome configuration problems with file actions
Diffstat (limited to 'apps/files_sharing')
-rw-r--r-- | apps/files_sharing/lib/share/file.php | 2 | ||||
-rw-r--r-- | apps/files_sharing/lib/sharedstorage.php | 18 |
2 files changed, 16 insertions, 4 deletions
diff --git a/apps/files_sharing/lib/share/file.php b/apps/files_sharing/lib/share/file.php index 82744924be3..c8821ee0fe8 100644 --- a/apps/files_sharing/lib/share/file.php +++ b/apps/files_sharing/lib/share/file.php @@ -91,6 +91,8 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent { // Remove Create permission if type is file $file['permissions'] &= ~OCP\Share::PERMISSION_CREATE; } + // NOTE: Temporary fix to allow unsharing of files in root of Shared directory + $file['permissions'] |= OCP\Share::PERMISSION_DELETE; $files[] = $file; } return $files; diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php index 6a2905b52c9..4530ce87777 100644 --- a/apps/files_sharing/lib/sharedstorage.php +++ b/apps/files_sharing/lib/sharedstorage.php @@ -209,7 +209,7 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common { public function isDeletable($path) { if ($path == '') { - return false; + return true; } return ($this->getPermissions($path) & OCP\Share::PERMISSION_DELETE); } @@ -306,9 +306,19 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common { public function unlink($path) { // Delete the file if DELETE permission is granted - if (($source = $this->getSourcePath($path)) && $this->isDeletable($path)) { - $storage = OC_Filesystem::getStorage($source); - return $storage->unlink($this->getInternalPath($source)); + if ($source = $this->getSourcePath($path)) { + if ($this->isDeletable($path)) { + $storage = OC_Filesystem::getStorage($source); + return $storage->unlink($this->getInternalPath($source)); + } else if (dirname($path) == '/' || dirname($path) == '.') { + // Unshare the file from the user if in the root of the Shared folder + if ($this->is_dir($path)) { + $itemType = 'folder'; + } else { + $itemType = 'file'; + } + return OCP\Share::unshareFromSelf($itemType, $path); + } } return false; } |