summaryrefslogtreecommitdiffstats
path: root/apps/sharebymail
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2017-01-04 08:59:43 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2017-04-13 12:58:50 +0200
commit12afd7d1d5bc2a85d04815964bf7fb37e77466d6 (patch)
tree11cd311669ab0b2895e3d471bcf974e3f287e31d /apps/sharebymail
parent2cbac3357ba445a3a4cd073e119efb871ea0f719 (diff)
downloadnextcloud-server-12afd7d1d5bc2a85d04815964bf7fb37e77466d6.tar.gz
nextcloud-server-12afd7d1d5bc2a85d04815964bf7fb37e77466d6.zip
Add mail element to access list
* Each provider just returns what they have so adding an element won't require changing everything * Added tests Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/sharebymail')
-rw-r--r--apps/sharebymail/lib/ShareByMailProvider.php22
1 files changed, 21 insertions, 1 deletions
diff --git a/apps/sharebymail/lib/ShareByMailProvider.php b/apps/sharebymail/lib/ShareByMailProvider.php
index c367130487d..14ed12749b7 100644
--- a/apps/sharebymail/lib/ShareByMailProvider.php
+++ b/apps/sharebymail/lib/ShareByMailProvider.php
@@ -835,7 +835,27 @@ class ShareByMailProvider implements IShareProvider {
}
public function getAccessList($nodes, $currentAccess) {
- return ['users' => [], 'remote' => false, 'public' => false];
+ $ids = [];
+ foreach ($nodes as $node) {
+ $ids[] = $node->getId();
+ }
+
+ $qb = $this->dbConnection->getQueryBuilder();
+ $qb->select('share_with')
+ ->from('share')
+ ->where($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_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->execute();
+
+ $mail = $cursor->fetch() !== false;
+ $cursor->closeCursor();
+
+ return ['mail' => $mail];
}
}