summaryrefslogtreecommitdiffstats
path: root/lib/private/share20
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2015-11-23 17:10:58 +0100
committerRoeland Jago Douma <rullzer@owncloud.com>2015-11-24 10:26:36 +0100
commita2b8483779b5cb868309ca3f98051bfcaafd6ff9 (patch)
treedd438b207d622f9d15cb4f1e423524190508cbad /lib/private/share20
parentaeae73b364048ebf3baf8cf6d692ac4f62467e7e (diff)
downloadnextcloud-server-a2b8483779b5cb868309ca3f98051bfcaafd6ff9.tar.gz
nextcloud-server-a2b8483779b5cb868309ca3f98051bfcaafd6ff9.zip
[Sharing 2.0] Default share provider only generic DI
No injection of userfolders etc. Only generic DI components (IRootFolder) etc should be used to make sure we can also run this from the cli
Diffstat (limited to 'lib/private/share20')
-rw-r--r--lib/private/share20/defaultshareprovider.php22
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/private/share20/defaultshareprovider.php b/lib/private/share20/defaultshareprovider.php
index 5805e41d411..15add93ce64 100644
--- a/lib/private/share20/defaultshareprovider.php
+++ b/lib/private/share20/defaultshareprovider.php
@@ -35,17 +35,17 @@ class DefaultShareProvider implements IShareProvider {
/** @var \OCP\IGroupManager */
private $groupManager;
- /** @var \OCP\Files\Folder */
- private $userFolder;
+ /** @var \OCP\Files\IRootFolder */
+ private $rootFolder;
public function __construct(\OCP\IDBConnection $connection,
\OCP\IUserManager $userManager,
\OCP\IGroupManager $groupManager,
- \OCP\Files\Folder $userFolder) {
+ \OCP\Files\IRootFolder $rootFolder) {
$this->dbConn = $connection;
$this->userManager = $userManager;
$this->groupManager = $groupManager;
- $this->userFolder = $userFolder;
+ $this->rootFolder = $rootFolder;
}
/**
@@ -218,14 +218,14 @@ class DefaultShareProvider implements IShareProvider {
$share->setSharedBy($this->userManager->get($data['uid_owner']));
// TODO: getById can return an array. How to handle this properly??
- $path = $this->userFolder->getById((int)$data['file_source']);
- $path = $path[0];
- $share->setPath($path);
+ $folder = $this->rootFolder->getUserFolder($share->getSharedBy()->getUID());
+ $path = $folder->getById((int)$data['file_source'])[0];
- $owner = $path->getStorage()->getOwner('.');
- if ($owner !== false) {
- $share->setShareOwner($this->userManager->get($owner));
- }
+ $owner = $path->getOwner();
+ $share->setShareOwner($owner);
+
+ $path = $this->rootFolder->getUserFolder($owner->getUID())->getById((int)$data['file_source'])[0];
+ $share->setPath($path);
if ($data['expiration'] !== null) {
$expiration = \DateTime::createFromFormat('Y-m-d H:i:s', $data['expiration']);