fix: anonymize user first and last names

This commit is contained in:
fromme committed 2026-09-23 17:22:19 +02:00
1 parent e751eed4a0
commit 96b7b3f451
2 files changed
+65

No files matched your search

+17
View File
@@ -97,6 +97,15 @@ class DatabaseAnonymizer
return $report;
}
/**
* Looked up by email alone, never by name: resolveIdentity() would register a name alias,
* and two accounts of the same person — an intended state here — would then collapse onto
* one synthetic identity and so onto one synthetic email, which User::$email is unique on.
*
* The names are only replaced where one is already set. Most accounts carry none until the
* BusPro import fills them in, and minting a name for those would turn an incomplete profile
* into one that looks complete while profileComplete still says otherwise.
*/
public function anonymizeUser(User $user): void
{
$identity = $this->resolveIdentity(
@@ -104,6 +113,14 @@ class DatabaseAnonymizer
);
$user->setEmail($identity['email']);
if ($this->hasReplaceableValue($user->getFirstName())) {
$user->setFirstName($identity['firstName']);
}
if ($this->hasReplaceableValue($user->getLastName())) {
$user->setLastName($identity['lastName']);
}
}
public function anonymizeNewsletterConsent(NewsletterConsent $consent): void