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
-------
ae255095ea
[Ldap] Make LdapUser implement EquatableInterface
This commit is contained in:
commit
c098374d21
@ -12,6 +12,7 @@
|
|||||||
namespace Symfony\Component\Ldap\Security;
|
namespace Symfony\Component\Ldap\Security;
|
||||||
|
|
||||||
use Symfony\Component\Ldap\Entry;
|
use Symfony\Component\Ldap\Entry;
|
||||||
|
use Symfony\Component\Security\Core\User\EquatableInterface;
|
||||||
use Symfony\Component\Security\Core\User\UserInterface;
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -19,7 +20,7 @@ use Symfony\Component\Security\Core\User\UserInterface;
|
|||||||
*
|
*
|
||||||
* @final
|
* @final
|
||||||
*/
|
*/
|
||||||
class LdapUser implements UserInterface
|
class LdapUser implements UserInterface, EquatableInterface
|
||||||
{
|
{
|
||||||
private $entry;
|
private $entry;
|
||||||
private $username;
|
private $username;
|
||||||
@ -88,4 +89,28 @@ class LdapUser implements UserInterface
|
|||||||
{
|
{
|
||||||
return $this->extraFields;
|
return $this->extraFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function isEqualTo(UserInterface $user): bool
|
||||||
|
{
|
||||||
|
if (!$user instanceof self) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->getPassword() !== $user->getPassword()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->getSalt() !== $user->getSalt()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->getUsername() !== $user->getUsername()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user