aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/KnownUser/KnownUserMapper.php
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2021-03-09 21:22:59 +0100
committerJoas Schilling <coding@schilljs.com>2021-03-10 17:19:55 +0100
commitc7be18c0d6cf6a5af2251abdfa18cdccd11da33b (patch)
tree13dcd637d5cc1437ec3febf8ba5f809ce11f7c63 /lib/private/KnownUser/KnownUserMapper.php
parent7baefcfc74d12da8a3850b6747da7c055c56e522 (diff)
downloadnextcloud-server-c7be18c0d6cf6a5af2251abdfa18cdccd11da33b.tar.gz
nextcloud-server-c7be18c0d6cf6a5af2251abdfa18cdccd11da33b.zip
Add a service to find out if a user knows another user
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/KnownUser/KnownUserMapper.php')
-rw-r--r--lib/private/KnownUser/KnownUserMapper.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/private/KnownUser/KnownUserMapper.php b/lib/private/KnownUser/KnownUserMapper.php
index 86e13a2e2f0..1144e2fd212 100644
--- a/lib/private/KnownUser/KnownUserMapper.php
+++ b/lib/private/KnownUser/KnownUserMapper.php
@@ -62,6 +62,19 @@ class KnownUserMapper extends QBMapper {
return (int) $query->execute();
}
+ /**
+ * @param string $knownTo
+ * @return KnownUser[]
+ */
+ public function getKnownTo(string $knownTo): array {
+ $query = $this->db->getQueryBuilder();
+ $query->select('*')
+ ->from($this->getTableName())
+ ->where($query->expr()->eq('known_to', $query->createNamedParameter($knownTo)));
+
+ return $this->findEntities($query);
+ }
+
public function createKnownUserFromRow(array $row): KnownUser {
return $this->mapRowToEntity([
'id' => $row['s_id'],