10000 bug #33239 [Ldap] Make LdapUser implement EquatableInterface (chalasr) · symfony/symfony@c098374 · GitHub
[go: up one dir, main page]

Skip to content

Commit c098374

Browse files
committed
bug #33239 [Ldap] Make LdapUser implement EquatableInterface (chalasr)
This PR was merged into the 4.4 branch. Discussion ---------- [Ldap] Make LdapUser implement EquatableInterface | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Bugfix because it is required for password migrations https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/Ldap/Security/LdapUserProvider.php#L128 Commits ------- ae25509 [Ldap] Make LdapUser implement EquatableInterface
2 parents 54b6eb1 + ae25509 commit c098374

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

src/Symfony/Component/Ldap/Security/LdapUser.php

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@
1212
namespace Symfony\Component\Ldap\Security;
1313

1414
use Symfony\Component\Ldap\Entry;
15+
use Symfony\Component\Security\Core\User\EquatableInterface;
1516
use Symfony\Component\Security\Core\User\UserInterface;
1617

1718
/**
1819
* @author Robin Chalas <robin.chalas@gmail.com>
1920
*
2021
* @final
2122
*/
22-
class LdapUser implements UserInterface
23+
class LdapUser implements UserInterface, EquatableInterface
2324
{
2425
private $entry;
2526
private $username;
@@ -88,4 +89,28 @@ public function getExtraFields(): array
8889
{
8990
return $this->extraFields;
9091
}
92+
93+
/**
94+
* {@inheritdoc}
95+
*/
96+
public function isEqualTo(UserInterface $user): bool
97+
{
98+
if (!$user instanceof self) {
99+
return false;
100+
}
101+
102+
if ($this->getPassword() !== $user->getPassword()) {
103+
return false;
104+
}
105+
106+
if ($this->getSalt() !== $user->getSalt()) {
107+
return false;
108+
}
109+
110+
if ($this->getUsername() !== $user->getUsername()) {
111+
return false;
112+
}
113+
114+
return true;
115+
}
91116
}

0 commit comments

Comments
 (0)
0