From 3a582e88e599d53108bcd7a299a56202513f3bd5 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Wed, 20 Jan 2016 14:17:25 +0100 Subject: [PATCH] Comments from Vincent --- apps/files_sharing/api/share20ocs.php | 8 +++----- lib/private/share20/defaultshareprovider.php | 8 ++++---- lib/private/share20/ishareprovider.php | 8 ++++---- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/apps/files_sharing/api/share20ocs.php b/apps/files_sharing/api/share20ocs.php index 2190582f3f..c2ff94db79 100644 --- a/apps/files_sharing/api/share20ocs.php +++ b/apps/files_sharing/api/share20ocs.php @@ -330,7 +330,6 @@ class Share20OCS { private function getSharedWithMe() { $userShares = $this->shareManager->getSharedWith($this->currentUser, \OCP\Share::SHARE_TYPE_USER, -1, 0); $groupShares = $this->shareManager->getSharedWith($this->currentUser, \OCP\Share::SHARE_TYPE_GROUP, -1, 0); - //TODO add federated provider $shares = array_merge($userShares, $groupShares); @@ -355,12 +354,11 @@ class Share20OCS { /** @var IShare[] $shares */ $shares = []; foreach ($nodes as $node) { - $userShares = array_merge($shares, $this->shareManager->getSharesBy($this->currentUser, \OCP\Share::SHARE_TYPE_USER, $node, false, -1, 0)); - $groupShares = array_merge($shares, $this->shareManager->getSharesBy($this->currentUser, \OCP\Share::SHARE_TYPE_GROUP, $node, false, -1, 0)); - $linkShares = array_merge($shares, $this->shareManager->getSharesBy($this->currentUser, \OCP\Share::SHARE_TYPE_LINK, $node, false, -1, 0)); + $shares = array_merge($shares, $this->shareManager->getSharesBy($this->currentUser, \OCP\Share::SHARE_TYPE_USER, $node, false, -1, 0)); + $shares = array_merge($shares, $this->shareManager->getSharesBy($this->currentUser, \OCP\Share::SHARE_TYPE_GROUP, $node, false, -1, 0)); + $shares = array_merge($shares, $this->shareManager->getSharesBy($this->currentUser, \OCP\Share::SHARE_TYPE_LINK, $node, false, -1, 0)); //TODO: Add federated shares - $shares = array_merge($shares, $userShares, $groupShares, $linkShares); } $formatted = []; diff --git a/lib/private/share20/defaultshareprovider.php b/lib/private/share20/defaultshareprovider.php index 596addb1e6..e0b437bbcc 100644 --- a/lib/private/share20/defaultshareprovider.php +++ b/lib/private/share20/defaultshareprovider.php @@ -367,8 +367,8 @@ class DefaultShareProvider implements IShareProvider { /** * Get shared with the given user * - * @param IUser $user - * @param int $shareType + * @param IUser $user get shares where this user is the recipient + * @param int $shareType \OCP\Share::SHARE_TYPE_USER or \OCP\Share::SHARE_TYPE_GROUP are supported * @param int $limit The maximum number of shares, -1 for all * @param int $offset * @return IShare[] @@ -450,7 +450,7 @@ class DefaultShareProvider implements IShareProvider { */ $shares = array_map([$this, 'resolveGroupShare'], $shares); } else { - throw new BackendError(); + throw new BackendError('Invalid backend'); } @@ -585,7 +585,7 @@ class DefaultShareProvider implements IShareProvider { * Thus if the user moved their group share make sure this is properly reflected here. * * @param Share $share - * @return Share + * @return Share Returns the updated share if one was found else return the original share. */ private function resolveGroupShare(Share $share) { $qb = $this->dbConn->getQueryBuilder(); diff --git a/lib/private/share20/ishareprovider.php b/lib/private/share20/ishareprovider.php index a5a9d3b670..36d0f10c7f 100644 --- a/lib/private/share20/ishareprovider.php +++ b/lib/private/share20/ishareprovider.php @@ -62,13 +62,13 @@ interface IShareProvider { * * @param IUser $user * @param int $shareType - * @param \OCP\Files\File|\OCP\Files\Folder $path - * @param bool $reshares + * @param \OCP\Files\File|\OCP\Files\Folder $node + * @param bool $reshares Also get the shares where $user is the owner instead of just the shares where $user is the initiator * @param int $limit The maximum number of shares to be returned, -1 for all shares * @param int $offset * @return Share[] */ - public function getSharesBy(IUser $user, $shareType, $path, $reshares, $limit, $offset); + public function getSharesBy(IUser $user, $shareType, $node, $reshares, $limit, $offset); /** * Get share by id @@ -98,7 +98,7 @@ interface IShareProvider { /** * Get shared with the given user * - * @param IUser $user + * @param IUser $user get shares where this user is the recipient * @param int $shareType * @param int $limit The max number of entries returned, -1 for all * @param int $offset