summaryrefslogtreecommitdiffstats
path: root/lib/private/Share20/Manager.php
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2016-05-11 20:48:27 +0200
committerBjörn Schießle <schiessle@owncloud.com>2016-05-20 21:15:15 +0200
commit7b25839bd51b3b6cd920209c254f014c03437113 (patch)
tree2e9885bdb068d56ff7bb9fde344c4da0cc95e2d3 /lib/private/Share20/Manager.php
parent81e3787f9cb4936f186b25e0dccb07b4e6dcce83 (diff)
downloadnextcloud-server-7b25839bd51b3b6cd920209c254f014c03437113.tar.gz
nextcloud-server-7b25839bd51b3b6cd920209c254f014c03437113.zip
use share initiator as fall back to access the file
in case of federated re-shares the owner can be a remote user. Therefore we can't always use to owner to access the local file
Diffstat (limited to 'lib/private/Share20/Manager.php')
-rw-r--r--lib/private/Share20/Manager.php15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php
index dee9e0cdd21..3568995472a 100644
--- a/lib/private/Share20/Manager.php
+++ b/lib/private/Share20/Manager.php
@@ -201,7 +201,12 @@ class Manager implements IManager {
}
// And you can't share your rootfolder
- if ($this->rootFolder->getUserFolder($share->getSharedBy())->getPath() === $share->getNode()->getPath()) {
+ if ($this->userManager->userExists($share->getSharedBy())) {
+ $sharedPath = $this->rootFolder->getUserFolder($share->getSharedBy())->getPath();
+ } else {
+ $sharedPath = $this->rootFolder->getUserFolder($share->getShareOwner())->getPath();
+ }
+ if ($sharedPath === $share->getNode()->getPath()) {
throw new \InvalidArgumentException('You can\'t share your root folder');
}
@@ -713,7 +718,11 @@ class Manager implements IManager {
}
if ($share->getPermissions() !== $originalShare->getPermissions()) {
- $userFolder = $this->rootFolder->getUserFolder($share->getShareOwner());
+ if ($this->userManager->userExists($share->getShareOwner())) {
+ $userFolder = $this->rootFolder->getUserFolder($share->getShareOwner());
+ } else {
+ $userFolder = $this->rootFolder->getUserFolder($share->getSharedBy());
+ }
\OC_Hook::emit('OCP\Share', 'post_update_permissions', array(
'itemType' => $share->getNode() instanceof \OCP\Files\File ? 'file' : 'folder',
'itemSource' => $share->getNode()->getId(),
@@ -1107,7 +1116,7 @@ class Manager implements IManager {
* @return \OCP\Share\IShare;
*/
public function newShare() {
- return new \OC\Share20\Share($this->rootFolder);
+ return new \OC\Share20\Share($this->rootFolder, $this->userManager);
}
/**