summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-07-31 11:55:59 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2014-09-22 17:25:15 +0200
commit89c3b650e6c47899ceea105713b389fe8af78bfa (patch)
treec5c653bcfe7de1f81dc1889636989aade9bc1eae /apps/files_sharing/lib
parent0d37e16499fd0bda83d4c41dfba626b3d9a489f5 (diff)
downloadnextcloud-server-89c3b650e6c47899ceea105713b389fe8af78bfa.tar.gz
nextcloud-server-89c3b650e6c47899ceea105713b389fe8af78bfa.zip
group shares and combine permissions
Diffstat (limited to 'apps/files_sharing/lib')
-rw-r--r--apps/files_sharing/lib/share/file.php2
-rw-r--r--apps/files_sharing/lib/sharedmount.php15
-rw-r--r--apps/files_sharing/lib/sharedstorage.php15
3 files changed, 29 insertions, 3 deletions
diff --git a/apps/files_sharing/lib/share/file.php b/apps/files_sharing/lib/share/file.php
index 2ae7fdc16ab..0cd66547d0b 100644
--- a/apps/files_sharing/lib/share/file.php
+++ b/apps/files_sharing/lib/share/file.php
@@ -38,7 +38,7 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent {
// FIXME: attributes should not be set here,
// keeping this pattern for now to avoid unexpected
// regressions
- $this->path = basename($path);
+ $this->path = \OC\Files\Filesystem::normalizePath(basename($path));
return true;
}
return false;
diff --git a/apps/files_sharing/lib/sharedmount.php b/apps/files_sharing/lib/sharedmount.php
index 564ac43ec74..9469e0aa48d 100644
--- a/apps/files_sharing/lib/sharedmount.php
+++ b/apps/files_sharing/lib/sharedmount.php
@@ -121,7 +121,15 @@ class SharedMount extends Mount implements MoveableMount {
$relTargetPath = $this->stripUserFilesPath($target);
$share = $this->storage->getShare();
- $result = $this->updateFileTarget($relTargetPath, $share);
+ $result = true;
+
+ if (!empty($share['grouped'])) {
+ foreach ($share['grouped'] as $s) {
+ $result = $this->updateFileTarget($relTargetPath, $s) && $result;
+ }
+ } else {
+ $result = $this->updateFileTarget($relTargetPath, $share) && $result;
+ }
if ($result) {
$this->setMountPoint($target);
@@ -144,8 +152,11 @@ class SharedMount extends Mount implements MoveableMount {
*/
public function removeMount() {
$mountManager = \OC\Files\Filesystem::getMountManager();
+ /**
+ * @var \OC\Files\Storage\Shared
+ */
$storage = $this->getStorage();
- $result = \OCP\Share::unshareFromSelf($storage->getItemType(), $storage->getMountPoint());
+ $result = $storage->unshareStorage();
$mountManager->removeMount($this->mountPoint);
return $result;
diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php
index 07f6b9da10c..a6799ddd369 100644
--- a/apps/files_sharing/lib/sharedstorage.php
+++ b/apps/files_sharing/lib/sharedstorage.php
@@ -532,4 +532,19 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage {
return null;
}
+ /**
+ * unshare complete storage, also the grouped shares
+ */
+ public function unshareStorage() {
+ $result = true;
+ if (!empty($this->share['grouped'])) {
+ foreach ($this->share['grouped'] as $share) {
+ $result = $result && \OCP\Share::unshareFromSelf($share['item_type'], $share['file_target']);
+ }
+ }
+ $result = $result && \OCP\Share::unshareFromSelf($this->getItemType(), $this->getMountPoint());
+
+ return $result;
+ }
+
}