summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2016-01-20 14:17:25 +0100
committerRoeland Jago Douma <rullzer@owncloud.com>2016-01-21 16:06:12 +0100
commit3a582e88e599d53108bcd7a299a56202513f3bd5 (patch)
treea742091972963d9aeb625b9bb7d4230be30e3042
parent9b5ea18ce56fef3de8403be97e0961dc7a082370 (diff)
downloadnextcloud-server-3a582e88e599d53108bcd7a299a56202513f3bd5.tar.gz
nextcloud-server-3a582e88e599d53108bcd7a299a56202513f3bd5.zip
Comments from Vincent
-rw-r--r--apps/files_sharing/api/share20ocs.php8
-rw-r--r--lib/private/share20/defaultshareprovider.php8
-rw-r--r--lib/private/share20/ishareprovider.php8
3 files changed, 11 insertions, 13 deletions
diff --git a/apps/files_sharing/api/share20ocs.php b/apps/files_sharing/api/share20ocs.php
index 2190582f3f4..c2ff94db790 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 596addb1e67..e0b437bbcc7 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 a5a9d3b6708..36d0f10c7f1 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