summaryrefslogtreecommitdiffstats
path: root/apps/federatedfilesharing
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2016-12-22 21:44:21 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2017-04-13 12:58:50 +0200
commit2cbac3357ba445a3a4cd073e119efb871ea0f719 (patch)
tree42f12e6334f0f14b8f122bf1355f325366123396 /apps/federatedfilesharing
parent97f8ca6595caf051eae9c9261bdbd481c9dd4be1 (diff)
downloadnextcloud-server-2cbac3357ba445a3a4cd073e119efb871ea0f719.tar.gz
nextcloud-server-2cbac3357ba445a3a4cd073e119efb871ea0f719.zip
Offload acceslist creation to providers
* This allows for effective queries. * Introduce currentAccess parameter to speciy if the users needs to have currently acces (deleted incomming group share). (For notifications) Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/federatedfilesharing')
-rw-r--r--apps/federatedfilesharing/lib/FederatedShareProvider.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/apps/federatedfilesharing/lib/FederatedShareProvider.php b/apps/federatedfilesharing/lib/FederatedShareProvider.php
index 120365263a9..b54f8a69fd1 100644
--- a/apps/federatedfilesharing/lib/FederatedShareProvider.php
+++ b/apps/federatedfilesharing/lib/FederatedShareProvider.php
@@ -28,6 +28,7 @@ namespace OCA\FederatedFileSharing;
use OC\Share20\Share;
use OCP\Federation\ICloudIdManager;
+use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\Files\Folder;
use OCP\Files\IRootFolder;
use OCP\IConfig;
@@ -974,4 +975,28 @@ class FederatedShareProvider implements IShareProvider {
$result = $this->config->getAppValue('files_sharing', 'lookupServerUploadEnabled', 'yes');
return ($result === 'yes');
}
+
+ public function getAccessList($nodes, $currentAccess) {
+ $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_REMOTE)))
+ ->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();
+
+ $remote = $cursor->fetch() !== false;
+ $cursor->closeCursor();
+
+ return ['users' => [], 'remote' => $remote, 'public' => false];
+ }
}