Skip to content
Snippets Groups Projects
Select Git revision
  • adfb407b594840da9045443aff8fc6e1f0873af6
  • master default protected
  • 5.x
  • ll-php8-bs5
  • release_5_bs5
  • ll-php8
  • 4.x
  • laminas_migration
  • release_1.0.0.2
  • release_4.0.0
  • release_3.2.8
  • bootstrap4_migration
  • 1.0.0.3
  • 6.0.7
  • 6.0.6
  • 6.0.5
  • 6.0.4
  • 6.0.3
  • 6.0.2
  • 6.0.1
  • 5.1.1
  • 6.0.0
  • 5.1.0
  • 5.0.0
  • 4.0.2
  • 3.2.11
  • 4.0.1
  • 3.2.10
  • 4.0.0
  • 1.0.0.2
  • 3.2.9
  • 3.2.8
32 results

Module.php

Blame
  • Bertrand Gauthier's avatar
    Bertrand Gauthier authored
    Tests unitaires correspondants.
    af53e02e
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    Module.php 5.65 KiB
    <?php
    
    namespace UnicaenAuth;
    
    use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
    use Zend\ModuleManager\Feature\ConfigProviderInterface;
    use Zend\ModuleManager\Feature\ServiceProviderInterface;
    use Zend\ModuleManager\Feature\ViewHelperProviderInterface;
    
    /**
     * Point d'entrée du module d'authentification Unicaen.
     * 
     * @author Bertrand GAUTHIER <bertrand.gauthier@unicaen.fr>
     */
    class Module implements ConfigProviderInterface, ViewHelperProviderInterface, ServiceProviderInterface
    {
        /**
         * 
         * @return array
         * @see ConfigProviderInterface
         */
        public function getConfig()
        {
            return include __DIR__ . '/config/module.config.php';
        }
    
        /**
         * 
         * @return array
         * @see AutoloaderProviderInterface
         */
        public function getAutoloaderConfig()
        {
            return array(
                'Zend\Loader\ClassMapAutoloader' => array(
                    __DIR__ . '/autoload_classmap.php',
                ),
                'Zend\Loader\StandardAutoloader' => array(
                    'namespaces' => array(
                        __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
                    ),
                ),
            );
        }
    
        /**
         * This method is called once the MVC bootstrapping is complete,
         * after the "loadModule.post" event, once $application->bootstrap() is called.
         * 
         * @param EventInterface $e
         * @see BootstrapListenerInterface
         */
        public function onBootstrap(\Zend\EventManager\EventInterface $e) /* @var \Zend\Mvc\MvcEvent $e */
        {
            $application = $e->getApplication();
            /* @var $services \Zend\ServiceManager\ServiceManager */
            $services    = $application->getServiceManager();
            
            // transmission des ACL aux aides de vue de navigation
            try {
                $authorizeService = $services->get('BjyAuthorize\Service\Authorize'); /* @var $authorizeService \BjyAuthorize\Service\Authorize */
                \Zend\View\Helper\Navigation::setDefaultAcl($authorizeService->getAcl());
                \Zend\View\Helper\Navigation::setDefaultRole($authorizeService->getIdentity());
            }
            catch (\Zend\ServiceManager\Exception\ServiceNotFoundException $snfe) {
                // pas de module BjyAuthorize : pas d'ACL
            }
    
            /* @var $options Options\ModuleOptions */
            $options = $services->get('unicaen-auth_module_options');