Comments from Vincent

This commit is contained in:
Roeland Jago Douma 2016-01-20 14:17:25 +01:00
parent 9b5ea18ce5
commit 3a582e88e5
3 changed files with 11 additions and 13 deletions

View File

@ -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 = [];

View File

@ -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();

View File

@ -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