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

  • Uid1Voter
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo
  • Download
 1: <?php
 2: 
 3: namespace Mapbender\DrupalIntegrationBundle\Security\Authorization\Voter;
 4: 
 5: use Symfony\Component\DependencyInjection\ContainerInterface;
 6: use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
 7: use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
 8: 
 9: /**
10:  * UID 1 voter.
11:  *
12:  * This voter grants access if Drupal user uid is 1.
13:  *
14:  * @author Christian Wygoda
15:  */
16: class Uid1Voter implements VoterInterface
17: {
18:     public function __construct(ContainerInterface $container)
19:     {
20:         $this->container = $container;
21:     }
22: 
23:     public function supportsAttribute($attribute)
24:     {
25:         return true;
26:     }
27: 
28:     public function supportsClass($class)
29:     {
30:         return true;
31:     }
32: 
33:     function vote(TokenInterface $token, $object, array $attributes)
34:     {
35:         $user = $token->getUser();
36: 
37:         if(is_object($user) && get_class($user) === 'Mapbender\DrupalIntegrationBundle\Security\User\DrupalUser' && $user->getId() == 1) {
38:             return VoterInterface::ACCESS_GRANTED;
39:         }
40: 
41:         return VoterInterface::ACCESS_ABSTAIN;
42:     }
43: }
44: 
Mapbender3 API documenation API documentation generated by ApiGen 2.8.0