summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorLouis Chemineau <louis@chmn.me>2022-04-19 12:54:28 +0200
committerLouis Chemineau <louis@chmn.me>2022-04-19 16:23:08 +0200
commite8ab298d2c718c0b6e671c127ffa51d840654cda (patch)
tree87cd45ef68b640cd5e5555aa6a9b6b99ebdab7ae /apps
parent70c56b411ee3eb20ebc206aa5cbf04254343f03f (diff)
downloadnextcloud-server-e8ab298d2c718c0b6e671c127ffa51d840654cda.tar.gz
nextcloud-server-e8ab298d2c718c0b6e671c127ffa51d840654cda.zip
Use email settings in DAV search
Signed-off-by: Louis Chemineau <louis@chmn.me>
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/lib/Connector/Sabre/Principal.php3
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php4
2 files changed, 6 insertions, 1 deletions
diff --git a/apps/dav/lib/Connector/Sabre/Principal.php b/apps/dav/lib/Connector/Sabre/Principal.php
index 4c7f17f4929..94e3978e67d 100644
--- a/apps/dav/lib/Connector/Sabre/Principal.php
+++ b/apps/dav/lib/Connector/Sabre/Principal.php
@@ -271,6 +271,7 @@ class Principal implements BackendInterface {
$limitEnumerationPhone = $this->shareManager->limitEnumerationToPhone();
$allowEnumerationFullMatch = $this->shareManager->allowEnumerationFullMatch();
$ignoreSecondDisplayName = $this->shareManager->ignoreSecondDisplayName();
+ $matchEmail = $this->shareManager->matchEmail();
// If sharing is restricted to group members only,
// return only members that have groups in common
@@ -299,7 +300,7 @@ class Principal implements BackendInterface {
switch ($prop) {
case '{http://sabredav.org/ns}email-address':
if (!$allowEnumeration) {
- if ($allowEnumerationFullMatch) {
+ if ($allowEnumerationFullMatch && $matchEmail) {
$users = $this->userManager->getByEmail($value);
} else {
$users = [];
diff --git a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php
index d7c074c9e3b..86413e4a366 100644
--- a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php
@@ -662,6 +662,10 @@ class PrincipalTest extends TestCase {
->method('allowEnumerationFullMatch')
->willReturn(true);
+ $this->shareManager->expects($this->once())
+ ->method('matchEmail')
+ ->willReturn(true);
+
$user2 = $this->createMock(IUser::class);
$user2->method('getUID')->willReturn('user2');
$user2->method('getDisplayName')->willReturn('User 2');