summaryrefslogtreecommitdiffstats
path: root/lib/private/Accounts
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-12-02 14:11:47 +0100
committerJoas Schilling <coding@schilljs.com>2020-12-07 14:19:37 +0100
commitfe9c46e595cba2d8e52db13cf15848a1f9d6f141 (patch)
tree3d52e51948a25b962e74c27dd6dc77ab36b54103 /lib/private/Accounts
parenteaba155a09ea7d226b538c5c8d046d2ea839b452 (diff)
downloadnextcloud-server-fe9c46e595cba2d8e52db13cf15848a1f9d6f141.tar.gz
nextcloud-server-fe9c46e595cba2d8e52db13cf15848a1f9d6f141.zip
Add an endpoint to search for accounts based on phone number
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Accounts')
-rw-r--r--lib/private/Accounts/AccountManager.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php
index c473d563781..39921dae9db 100644
--- a/lib/private/Accounts/AccountManager.php
+++ b/lib/private/Accounts/AccountManager.php
@@ -34,6 +34,7 @@ use OCA\Settings\BackgroundJobs\VerifyUserData;
use OCP\Accounts\IAccount;
use OCP\Accounts\IAccountManager;
use OCP\BackgroundJob\IJobList;
+use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
use OCP\IUser;
use Psr\Log\LoggerInterface;
@@ -171,6 +172,24 @@ class AccountManager implements IAccountManager {
return $userDataArray;
}
+ public function searchUsers(string $property, array $values): array {
+ $query = $this->connection->getQueryBuilder();
+ $query->select('*')
+ ->from($this->dataTable)
+ ->where($query->expr()->eq('name', $query->createNamedParameter($property)))
+ ->andWhere($query->expr()->in('value', $query->createNamedParameter($values, IQueryBuilder::PARAM_STR_ARRAY)));
+
+ $result = $query->execute();
+ $matches = [];
+
+ while ($row = $result->fetch()) {
+ $matches[$row['value']] = $row['uid'];
+ }
+ $result->closeCursor();
+
+ return $matches;
+ }
+
/**
* check if we need to ask the server for email verification, if yes we create a cronjob
*