Clean up the logic of the contacts store a bit

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2021-03-10 20:31:12 +01:00
parent 5fa52d492a
commit 62ef45028e
No known key found for this signature in database
GPG Key ID: 7076EA9751AACDDA
1 changed files with 5 additions and 5 deletions

View File

@ -165,21 +165,21 @@ class ContactsStore implements IContactsStore {
return false; return false;
} }
$filterUser = true; $filterOutUser = true;
$mailAddresses = $entry->getEMailAddresses(); $mailAddresses = $entry->getEMailAddresses();
foreach ($mailAddresses as $mailAddress) { foreach ($mailAddresses as $mailAddress) {
if ($mailAddress === $filter) { if ($mailAddress === $filter) {
$filterUser = false; $filterOutUser = false;
break; break;
} }
} }
if ($entry->getProperty('UID') && $entry->getProperty('UID') === $filter) { if ($entry->getProperty('UID') && $entry->getProperty('UID') === $filter) {
$filterUser = false; $filterOutUser = false;
} }
if ($filterUser) { if ($filterOutUser) {
return false; return false;
} }
} elseif ($restrictEnumerationPhone || $restrictEnumerationGroup) { } elseif ($restrictEnumerationPhone || $restrictEnumerationGroup) {
@ -208,7 +208,7 @@ class ContactsStore implements IContactsStore {
if ($ownGroupsOnly && !$checkedCommonGroupAlready) { if ($ownGroupsOnly && !$checkedCommonGroupAlready) {
$user = $this->userManager->get($entry->getProperty('UID')); $user = $this->userManager->get($entry->getProperty('UID'));
if ($user === null) { if (!$user instanceof IUser) {
return false; return false;
} }