aboutsummaryrefslogtreecommitdiffstats
path: root/apps/sharebymail
diff options
context:
space:
mode:
authorAdam Serbinski <adam@serbinski.com>2022-05-27 10:40:54 -0400
committerAdam Serbinski <37986043+ASerbinski@users.noreply.github.com>2024-03-21 18:25:31 -0400
commit26ae5e6dfbdd482e6fbfe1cd6a1161ff39f984cc (patch)
tree5767cefae65ec46a956e318bddb8215fc66fa755 /apps/sharebymail
parent5ca6249f42d3e7cfde1857d2973283d4eec824e8 (diff)
downloadnextcloud-server-26ae5e6dfbdd482e6fbfe1cd6a1161ff39f984cc.tar.gz
nextcloud-server-26ae5e6dfbdd482e6fbfe1cd6a1161ff39f984cc.zip
ShareByMailProvider: getAccessList: return full list of recipients
Previously was returning only boolean true if the Node was shared by email, or false if not. Now provides an array containing the list of email share recipients. Signed-off-by: Adam Serbinski <adam@serbinski.com>
Diffstat (limited to 'apps/sharebymail')
-rw-r--r--apps/sharebymail/lib/ShareByMailProvider.php16
1 files changed, 12 insertions, 4 deletions
diff --git a/apps/sharebymail/lib/ShareByMailProvider.php b/apps/sharebymail/lib/ShareByMailProvider.php
index 5a840b895ff..8c5962e22fc 100644
--- a/apps/sharebymail/lib/ShareByMailProvider.php
+++ b/apps/sharebymail/lib/ShareByMailProvider.php
@@ -1098,18 +1098,26 @@ class ShareByMailProvider implements IShareProvider {
}
$qb = $this->dbConnection->getQueryBuilder();
- $qb->select('share_with')
+ $qb->select('share_with', 'file_source')
->from('share')
->where($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_EMAIL)))
->andWhere($qb->expr()->in('file_source', $qb->createNamedParameter($ids, IQueryBuilder::PARAM_INT_ARRAY)))
->andWhere($qb->expr()->orX(
$qb->expr()->eq('item_type', $qb->createNamedParameter('file')),
$qb->expr()->eq('item_type', $qb->createNamedParameter('folder'))
- ))
- ->setMaxResults(1);
+ ));
$cursor = $qb->executeQuery();
- $mail = $cursor->fetch() !== false;
+ $mail = array();
+ while ($row = $cursor->fetch()) {
+ if ($currentAccess === false) {
+ $mail[] = $row['share_with'];
+ } else {
+ $mail[$row['share_with']] = [
+ 'node_id' => $row['file_source']
+ ];
+ }
+ }
$cursor->closeCursor();
return ['public' => $mail];