Selaa lähdekoodia

renamed reloadUserByAccount() to loadUserByAccount()

Fabien Potencier 14 vuotta sitten
vanhempi
commit
b57411b5ec

+ 1 - 1
src/Symfony/Bundle/DoctrineBundle/Security/EntityUserProvider.php

@@ -45,7 +45,7 @@ class EntityUserProvider implements UserProviderInterface
     /**
      * {@inheritDoc}
      */
-    public function reloadUserByAccount(AccountInterface $account)
+    public function loadUserByAccount(AccountInterface $account)
     {
         if (!$account instanceof $this->class) {
             throw new UnsupportedAccountException(sprintf('Instances of "%s" are not supported.', get_class($account)));

+ 1 - 1
src/Symfony/Bundle/DoctrineMongoDBBundle/Security/DocumentUserProvider.php

@@ -45,7 +45,7 @@ class DocumentUserProvider implements UserProviderInterface
     /**
      * {@inheritDoc}
      */
-    public function reloadUserByAccount(AccountInterface $account)
+    public function loadUserByAccount(AccountInterface $account)
     {
         if (!$account instanceof $this->class) {
             throw new UnsupportedAccountException(sprintf('Instances of "%s" are not supported.', get_class($account)));

+ 4 - 3
src/Symfony/Component/HttpKernel/Security/Firewall/ContextListener.php

@@ -123,6 +123,7 @@ class ContextListener implements ListenerInterface
      * Refreshes the user by reloading it from the user provider
      *
      * @param TokenInterface $token
+     *
      * @return TokenInterface|null
      */
     protected function refreshUser(TokenInterface $token)
@@ -138,7 +139,7 @@ class ContextListener implements ListenerInterface
 
         foreach ($this->userProviders as $provider) {
             try {
-                $cUser = $provider->reloadUserByAccount($user);
+                $cUser = $provider->loadUserByAccount($user);
 
                 $token->setRoles($cUser->getRoles());
                 $token->setUser($cUser);
@@ -149,12 +150,12 @@ class ContextListener implements ListenerInterface
 
                 return $token;
             } catch (UnsupportedAccountException $unsupported) {
+                // let's try the next user provider
             } catch (UsernameNotFoundException $notFound) {
-                
                 return null;
             }
         }
 
         throw new \RuntimeException(sprintf('There is no user provider for user "%s".', get_class($user)));
     }
-}
+}

+ 1 - 1
src/Symfony/Component/Security/Authentication/Provider/DaoAuthenticationProvider.php

@@ -87,7 +87,7 @@ class DaoAuthenticationProvider extends UserAuthenticationProvider
             if (!$user instanceof AccountInterface) {
                 throw new AuthenticationServiceException('The user provider must return an AccountInterface object.');
             }
-    
+
             return $user;
         } catch (UsernameNotFoundException $notFound) {
             throw $notFound;

+ 2 - 2
src/Symfony/Component/Security/Authentication/Provider/UserAuthenticationProvider.php

@@ -59,11 +59,11 @@ abstract class UserAuthenticationProvider implements AuthenticationProviderInter
             if (!$user instanceof AccountInterface) {
                 throw new AuthenticationServiceException('retrieveUser() must return an AccountInterface.');
             }
-            
+
             $this->accountChecker->checkPreAuth($user);
             $this->checkAuthentication($user, $token);
             $this->accountChecker->checkPostAuth($user);
-    
+
             return new UsernamePasswordToken($user, $token->getCredentials(), $user->getRoles());
         } catch (UsernameNotFoundException $notFound) {
             if ($this->hideUserNotFoundExceptions) {

+ 1 - 1
src/Symfony/Component/Security/User/InMemoryUserProvider.php

@@ -79,7 +79,7 @@ class InMemoryUserProvider implements UserProviderInterface
     /**
      * {@inheritDoc}
      */
-    public function reloadUserByAccount(AccountInterface $account)
+    public function loadUserByAccount(AccountInterface $account)
     {
         if (!$account instanceof User) {
             throw new UnsupportedAccountException(sprintf('Instances of "%s" are not supported.', get_class($account)));

+ 5 - 3
src/Symfony/Component/Security/User/UserProviderInterface.php

@@ -27,20 +27,22 @@ interface UserProviderInterface
      *
      * @throws UsernameNotFoundException if the user is not found
      * @param string $username The username
+     *
      * @return AccountInterface
      */
      function loadUserByUsername($username);
 
      /**
       * Loads the user for the account interface.
-      * 
+      *
       * It is up to the implementation if it decides to reload the user data
       * from the database, or if it simply merges the passed User into the 
       * identity map of an entity manager.
-      * 
+      *
       * @throws UnsupportedAccountException if the account is not supported
       * @param AccountInterface $user
+      *
       * @return AccountInterface
       */
-     function reloadUserByAccount(AccountInterface $user);
+     function loadUserByAccount(AccountInterface $user);
 }