[Ldap] Make LdapUser implement EquatableInterface
This commit is contained in:
parent
034c06e181
commit
ae255095ea
@ -12,6 +12,7 @@
|
||||
namespace Symfony\Component\Ldap\Security;
|
||||
|
||||
use Symfony\Component\Ldap\Entry;
|
||||
use Symfony\Component\Security\Core\User\EquatableInterface;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
|
||||
/**
|
||||
@ -19,7 +20,7 @@ use Symfony\Component\Security\Core\User\UserInterface;
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class LdapUser implements UserInterface
|
||||
class LdapUser implements UserInterface, EquatableInterface
|
||||
{
|
||||
private $entry;
|
||||
private $username;
|
||||
@ -88,4 +89,28 @@ class LdapUser implements UserInterface
|
||||
{
|
||||
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