Commit 5ec96155 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Amélioration : Authentification par base de données : Possibilité désormais de...

Amélioration : Authentification par base de données : Possibilité désormais de spécifier une connexion autre que la connexion principale 'orm_default'.
parent 39c91b1d
Loading
Loading
Loading
Loading
+18 −3
Original line number Diff line number Diff line
@@ -58,9 +58,14 @@ class Module implements ConfigProviderInterface, ViewHelperProviderInterface, Se
        $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');
@@ -153,6 +158,16 @@ class Module implements ConfigProviderInterface, ViewHelperProviderInterface, Se
    {
        return array(
            'factories' => array(
                'zfcuser_user_mapper' => function ($sm) {
                    $config = $sm->get('configuration');
                    $em = isset($config['doctrine']['connection']['orm_auth']) ? 
                            'doctrine.entitymanager.orm_auth' :
                            'doctrine.entitymanager.orm_default';
                    return new \ZfcUserDoctrineORM\Mapper\User(
                        $sm->get($em),
                        $sm->get('zfcuser_module_options')
                    );
                },
                'unicaen-auth_user_service' => function () {
                    return new Service\User();
                },
+12 −2
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
$settings = array(
    
);

$zfcuserSettings = array(
    /**
     * Enable registration
@@ -57,6 +58,7 @@ $zfcuserSettings = array(
        100 => 'UnicaenAuth\Authentication\Adapter\Cas',  //         ensuite (si échec d'authentification Db)
    ),
);

$bjyauthorize = array(
    /* this module uses a meta-role that inherits from any roles that should
     * be applied to the active user. the identity provider tells us which
@@ -112,6 +114,14 @@ return array(
    'zfcuser' => $zfcuserSettings,
    'bjyauthorize' => $bjyauthorize,
    'unicaen-auth' => $settings,
    'doctrine' => array(
        'entitymanager' => array(
            'orm_auth' => array(
                'connection'    => 'orm_auth',
                'configuration' => 'orm_default'
            )
        ),
    ),
    'service_manager' => array(
        'abstract_factories' => array(
            'UnicaenAuth\Authentication\Adapter\AbstractFactory',
@@ -143,7 +153,7 @@ return array(
    ),
    'controllers' => array(
        'invokables' => array(
            'unicaen-auth' => 'UnicaenAuth\Controller\UtilisateurController',
            
        ),
    ),
    'view_manager' => array(
+2 −3
Original line number Diff line number Diff line
@@ -12,9 +12,8 @@ $settings = array(
     */
    'save_ldap_user_in_database' => false,
    /**
     * Enable registration
     * Allows users to register through the website.
     * Accepted values: boolean true or false
     * Flag indiquant si l'utilisateur peut s'enregistrer auprès de l'application 
     * (i.e. créer un compte dans la table des utilisateurs).
     */
    'enable_registration' => false,
);
+19 −0
Original line number Diff line number Diff line
@@ -6,6 +6,24 @@
 * drop this config file in it and change the values as you wish.
 */
$settings = array(
    /**
     * Connexion à la base de donnée d'authentification via Doctrine.
     * Décommenter pour spécifier une connexion autre que la connexion principale 'orm_default'.
     */
//    'doctrine' => array(
//        'connection' => array(
//            'orm_auth' => array(
//                'driverClass' => 'Doctrine\DBAL\Driver\PDOMySql\Driver',
//                'params' => array(
//                    'host'     => 'localhost',
//                    'port'     => '3306',
//                    'user'     => 'root',
//                    'password' => 'root',
//                    'dbname'   => 'authdb',
//                )
//            ),
//        ),
//    ),
    /**
     * Paramètres de connexion au serveur CAS :
     * - pour désactiver l'authentification CAS, le tableau 'cas' doit être vide.
@@ -36,4 +54,5 @@ $settings = array(
 */
return array(
    'unicaen-auth' => $settings,
    'doctrine'     => isset($settings['doctrine']) ? $settings['doctrine'] : array(),
);
 No newline at end of file