[Share 2.0] Add subfiles=x
This commit is contained in:
parent
247b2ee0aa
commit
0a9cd91e1d
|
@ -342,6 +342,46 @@ class Share20OCS {
|
|||
return new \OC_OCS_Result($formatted);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \OCP\Files\Folder $folder
|
||||
* @return \OC_OCS_Result
|
||||
*/
|
||||
private function getSharesInDir($folder) {
|
||||
if (!($folder instanceof \OCP\Files\Folder)) {
|
||||
return new \OC_OCS_Result(null, 400, "not a directory");
|
||||
}
|
||||
|
||||
$nodes = $folder->getDirectoryListing();
|
||||
/** @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));
|
||||
//TODO: Add federated shares
|
||||
|
||||
$shares = array_merge($shares, $userShares, $groupShares, $linkShares);
|
||||
}
|
||||
|
||||
$formatted = [];
|
||||
foreach ($shares as $share) {
|
||||
$formatted[] = $this->formatShare($share);
|
||||
}
|
||||
|
||||
return new \OC_OCS_Result($formatted);
|
||||
}
|
||||
|
||||
/**
|
||||
* The getShares function.
|
||||
*
|
||||
* - Get shares by the current user
|
||||
* - Get shares by the current user and reshares (?reshares=true)
|
||||
* - Get shares with the current user (?shared_with_me=true)
|
||||
* - Get shares for a specific path (?path=...)
|
||||
* - Get all shares in a folder (?subfiles=true&path=..)
|
||||
*
|
||||
* @return \OC_OCS_Result
|
||||
*/
|
||||
public function getShares() {
|
||||
$sharedWithMe = $this->request->getParam('shared_with_me', null);
|
||||
$reshares = $this->request->getParam('reshares', null);
|
||||
|
@ -361,6 +401,10 @@ class Share20OCS {
|
|||
}
|
||||
}
|
||||
|
||||
if ($subfiles === 'true') {
|
||||
return $this->getSharesInDir($path);
|
||||
}
|
||||
|
||||
if ($reshares === 'true') {
|
||||
$reshares = true;
|
||||
} else {
|
||||
|
|
|
@ -279,9 +279,9 @@ class DefaultShareProvider implements IShareProvider {
|
|||
|
||||
if ($limit !== -1) {
|
||||
$qb->setMaxResults($limit);
|
||||
$qb->setFirstResult($offset);
|
||||
}
|
||||
|
||||
$qb->setFirstResult($offset);
|
||||
$qb->orderBy('id');
|
||||
|
||||
$cursor = $qb->execute();
|
||||
|
|
|
@ -678,18 +678,6 @@ class Manager {
|
|||
public function getSharesByPath(\OCP\Files\Node $path, $page=0, $perPage=50) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all shares that are shared with the current user
|
||||
*
|
||||
* @param int $shareType
|
||||
* @param int $page
|
||||
* @param int $perPage
|
||||
*
|
||||
* @return Share[]
|
||||
*/
|
||||
public function getSharedWithMe($shareType = null, $page=0, $perPage=50) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the share by token possible with password
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue