summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib/sharedstorage.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-06-29 19:13:39 +0200
committerRobin Appelman <icewind@owncloud.com>2015-07-01 15:10:22 +0200
commitd6f56ea609c41431458c0b565042caf945ab56cc (patch)
tree9c892e68d5b1d50e9ec6b9611089e32f996b0b63 /apps/files_sharing/lib/sharedstorage.php
parent5caeda33f155145a74f6108326deb13314eedff2 (diff)
downloadnextcloud-server-d6f56ea609c41431458c0b565042caf945ab56cc.tar.gz
nextcloud-server-d6f56ea609c41431458c0b565042caf945ab56cc.zip
lock parent folders for the owner when locking a shared file as recipient
Diffstat (limited to 'apps/files_sharing/lib/sharedstorage.php')
-rw-r--r--apps/files_sharing/lib/sharedstorage.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php
index 50957663b34..e54f747d3ba 100644
--- a/apps/files_sharing/lib/sharedstorage.php
+++ b/apps/files_sharing/lib/sharedstorage.php
@@ -45,8 +45,14 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage {
private $files = array();
private static $isInitialized = array();
+ /**
+ * @var \OC\Files\View
+ */
+ private $ownerView;
+
public function __construct($arguments) {
$this->share = $arguments['share'];
+ $this->ownerView = $arguments['ownerView'];
}
/**
@@ -623,6 +629,11 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage {
/** @var \OCP\Files\Storage $targetStorage */
list($targetStorage, $targetInternalPath) = $this->resolvePath($path);
$targetStorage->acquireLock($targetInternalPath, $type, $provider);
+ // lock the parent folders of the owner when locking the share as recipient
+ if ($path === '') {
+ $sourcePath = $this->ownerView->getPath($this->share['file_source']);
+ $this->ownerView->lockFile($sourcePath, ILockingProvider::LOCK_SHARED, true);
+ }
}
/**
@@ -634,6 +645,11 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage {
/** @var \OCP\Files\Storage $targetStorage */
list($targetStorage, $targetInternalPath) = $this->resolvePath($path);
$targetStorage->releaseLock($targetInternalPath, $type, $provider);
+ // unlock the parent folders of the owner when unlocking the share as recipient
+ if ($path === '') {
+ $sourcePath = $this->ownerView->getPath($this->share['file_source']);
+ $this->ownerView->unlockFile($sourcePath, ILockingProvider::LOCK_SHARED, true);
+ }
}
/**