Overview

Namespaces

  • Mapbender
    • Component
      • HTTP
    • CoreBundle
      • Command
      • Component
        • Exception
      • Controller
      • DataFixtures
        • ORM
      • DependencyInjection
      • Element
        • Type
      • Entity
      • EventListener
      • Extension
      • Form
        • DataTransformer
        • EventListener
        • Type
      • Security
      • Template
    • DrupalIntegrationBundle
      • DependencyInjection
      • Security
        • Authentication
          • Provider
          • Token
        • Authorization
          • Voter
        • Factory
        • Firewall
        • User
      • Session
    • KmlBundle
      • Element
    • ManagerBundle
      • Controller
      • Form
        • DataTransformer
        • Type
    • MonitoringBundle
      • Command
      • Component
      • Controller
      • DependencyInjection
      • Entity
      • EventListener
      • Form
    • PrintBundle
      • Component
      • Controller
    • WmcBundle
      • Component
        • Exception
      • Element
        • Type
      • Entity
      • Form
        • EventListener
        • Type
    • WmsBundle
      • Component
        • Exception
      • Controller
      • DependencyInjection
      • Element
        • Type
      • Entity
      • Event
      • Form
        • EventListener
        • Type
    • WmtsBundle
      • Component
        • Exception
      • Controller
      • Entity
      • Form
        • Type
  • None
  • PHP

Classes

  • DrupalUser
  • DrupalUserProvider
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo
  • Download
 1: <?php
 2: 
 3: namespace Mapbender\DrupalIntegrationBundle\Security\User;
 4: 
 5: use Symfony\Component\Security\Core\User\UserProviderInterface;
 6: use Symfony\Component\Security\Core\User\UserInterface;
 7: use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
 8: use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
 9: 
10: 
11: class DrupalUserProvider implements UserProviderInterface
12: {
13:     public function loadUserByUsername($username)
14:     {
15:         $drupalUser = user_load_by_name($username);
16:         if($drupalUser !== False) {
17:             return new DrupalUser($drupalUser);
18:         }
19: 
20:         throw new UsernameNotFoundException(sprintf('Username "%s" does not exist.', $username));
21:     }
22: 
23:     public function refreshUser(UserInterface $user)
24:     {
25:         if (!$user instanceof DrupalUser) {
26:             throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', get_class($user)));
27:         }
28: 
29:         return $this->loadUserByUsername($user->getUsername());
30:     }
31: 
32:     public function supportsClass($class)
33:     {
34:         return $class === 'Mapbender\DrupalIntegrationBundle\Security\User\DrupalUser';
35:     }
36: }
37: 
Mapbender3 API documenation API documentation generated by ApiGen 2.8.0