summaryrefslogtreecommitdiffstats
path: root/Core/User/User.php
diff options
context:
space:
mode:
authorBernhard Schussek <bernhard.schussek@symfony-project.com>2011-03-13 18:10:39 +0100
committerBernhard Schussek <bernhard.schussek@symfony-project.com>2011-03-13 19:15:25 +0100
commit263ba4d42870ef5f991540c8b039c2472ba8b204 (patch)
tree90a84bb2a178be744ef3815c6a2bb7268baa9f34 /Core/User/User.php
parent4a5d6729bc8c7f4adc89c153606617390bb24ca4 (diff)
parent5a06947e48c33dc57e21e4316c8b7c6e8f5827b0 (diff)
downloadsymfony-security-263ba4d42870ef5f991540c8b039c2472ba8b204.zip
symfony-security-263ba4d42870ef5f991540c8b039c2472ba8b204.tar.gz
symfony-security-263ba4d42870ef5f991540c8b039c2472ba8b204.tar.bz2
Merge remote branch 'symfony/master' into event-manager
Conflicts: src/Symfony/Bundle/FrameworkBundle/Debug/TraceableEventManager.php src/Symfony/Bundle/WebProfilerBundle/WebDebugToolbarListener.php src/Symfony/Component/Security/Http/Firewall.php src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php src/Symfony/Component/Security/Http/Firewall/AbstractPreAuthenticatedListener.php src/Symfony/Component/Security/Http/Firewall/AccessListener.php src/Symfony/Component/Security/Http/Firewall/AnonymousAuthenticationListener.php src/Symfony/Component/Security/Http/Firewall/BasicAuthenticationListener.php src/Symfony/Component/Security/Http/Firewall/ChannelListener.php src/Symfony/Component/Security/Http/Firewall/ContextListener.php src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php src/Symfony/Component/Security/Http/Firewall/ListenerInterface.php src/Symfony/Component/Security/Http/Firewall/LogoutListener.php src/Symfony/Component/Security/Http/Firewall/RememberMeListener.php src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php tests/Symfony/Tests/Component/Security/Http/Firewall/RememberMeListenerTest.php
Diffstat (limited to 'Core/User/User.php')
-rw-r--r--Core/User/User.php48
1 files changed, 20 insertions, 28 deletions
diff --git a/Core/User/User.php b/Core/User/User.php
index 02a2c06..7dcdee3 100644
--- a/Core/User/User.php
+++ b/Core/User/User.php
@@ -18,16 +18,16 @@ namespace Symfony\Component\Security\Core\User;
*
* @author Fabien Potencier <fabien@symfony.com>
*/
-class User implements AdvancedAccountInterface
+final class User implements AdvancedUserInterface
{
- protected $username;
- protected $password;
- protected $accountNonExpired;
- protected $credentialsNonExpired;
- protected $accountNonLocked;
- protected $roles;
-
- public function __construct($username, $password, array $roles = array(), $enabled = true, $accountNonExpired = true, $credentialsNonExpired = true, $accountNonLocked = true)
+ private $username;
+ private $password;
+ private $userNonExpired;
+ private $credentialsNonExpired;
+ private $userNonLocked;
+ private $roles;
+
+ public function __construct($username, $password, array $roles = array(), $enabled = true, $userNonExpired = true, $credentialsNonExpired = true, $userNonLocked = true)
{
if (empty($username)) {
throw new \InvalidArgumentException('The username cannot be empty.');
@@ -36,23 +36,15 @@ class User implements AdvancedAccountInterface
$this->username = $username;
$this->password = $password;
$this->enabled = $enabled;
- $this->accountNonExpired = $accountNonExpired;
+ $this->accountNonExpired = $userNonExpired;
$this->credentialsNonExpired = $credentialsNonExpired;
- $this->accountNonLocked = $accountNonLocked;
+ $this->accountNonLocked = $userNonLocked;
$this->roles = $roles;
}
/**
* {@inheritdoc}
*/
- public function __toString()
- {
- return $this->username;
- }
-
- /**
- * {@inheritdoc}
- */
public function getRoles()
{
return $this->roles;
@@ -124,37 +116,37 @@ class User implements AdvancedAccountInterface
/**
* {@inheritDoc}
*/
- public function equals(AccountInterface $account)
+ public function equals(UserInterface $user)
{
- if (!$account instanceof User) {
+ if (!$user instanceof User) {
return false;
}
- if ($this->password !== $account->getPassword()) {
+ if ($this->password !== $user->getPassword()) {
return false;
}
- if ($this->getSalt() !== $account->getSalt()) {
+ if ($this->getSalt() !== $user->getSalt()) {
return false;
}
- if ($this->username !== $account->getUsername()) {
+ if ($this->username !== $user->getUsername()) {
return false;
}
- if ($this->accountNonExpired !== $account->isAccountNonExpired()) {
+ if ($this->accountNonExpired !== $user->isAccountNonExpired()) {
return false;
}
- if ($this->accountNonLocked !== $account->isAccountNonLocked()) {
+ if ($this->accountNonLocked !== $user->isAccountNonLocked()) {
return false;
}
- if ($this->credentialsNonExpired !== $account->isCredentialsNonExpired()) {
+ if ($this->credentialsNonExpired !== $user->isCredentialsNonExpired()) {
return false;
}
- if ($this->enabled !== $account->isEnabled()) {
+ if ($this->enabled !== $user->isEnabled()) {
return false;
}