aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Share20
diff options
context:
space:
mode:
authorLouis Chemineau <louis@chmn.me>2022-04-27 13:17:22 +0200
committerLouis (Rebase PR Action) <artonge@users.noreply.github.com>2022-07-26 12:17:46 +0000
commit0fb4ecadae86a90bc05e16bdf5845a80e255c642 (patch)
treea984678b32f3fc4e2051036cea53a974f204f784 /lib/private/Share20
parentb513ac51fb8be581085ff7da51e4055b2d9e97ee (diff)
downloadnextcloud-server-0fb4ecadae86a90bc05e16bdf5845a80e255c642.tar.gz
nextcloud-server-0fb4ecadae86a90bc05e16bdf5845a80e255c642.zip
Recursively fetch subshares
Signed-off-by: Louis Chemineau <louis@chmn.me>
Diffstat (limited to 'lib/private/Share20')
-rw-r--r--lib/private/Share20/Manager.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php
index 905a006372f..fd1a27af8cf 100644
--- a/lib/private/Share20/Manager.php
+++ b/lib/private/Share20/Manager.php
@@ -1319,6 +1319,24 @@ class Manager implements IManager {
}, []);
}
+ public function getSharesInFolderRecursive(string $userId, Folder $node, $reshares = false) {
+ $shares = $this->getSharesInFolder($userId, $node, $reshares);
+
+ foreach ($node->getDirectoryListing() as $subnode) {
+ if (!$subnode instanceof Folder) {
+ continue;
+ }
+
+ $subShares = $this->getSharesInFolderRecursive($userId, $subnode, $reshares);
+
+ foreach ($subShares as $fileId => $subSharesForFile) {
+ $shares[$fileId] = array_merge($shares[$fileId] ?? [], $subSharesForFile);
+ }
+ }
+
+ return $shares;
+ }
+
/**
* @inheritdoc
*/