module.config.php 10 KB
Newer Older
Bertrand Gauthier's avatar
Bertrand Gauthier committed
1
2
3
4
<?php
$settings = array(
    
);
5

Bertrand Gauthier's avatar
Bertrand Gauthier committed
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
$zfcuserSettings = array(
    /**
     * Enable registration
     * Allows users to register through the website.
     * Accepted values: boolean true or false
     */
    'enable_registration' => true,
    /**
     * Modes for authentication identity match
     * Specify the allowable identity modes, in the order they should be
     * checked by the Authentication plugin.
     * Default value: array containing 'email'
     * Accepted values: array containing one or more of: email, username
     */
    'auth_identity_fields' => array('username'),
    /**
     * Login Redirect Route
     * Upon successful login the user will be redirected to the entered route
     * Default value: 'zfcuser'
     * Accepted values: A valid route name within your application
     */
    'login_redirect_route' => 'home',
    /**
     * Logout Redirect Route
     * Upon logging out the user will be redirected to the enterd route
     * Default value: 'zfcuser/login'
     * Accepted values: A valid route name within your application
     */
    'logout_redirect_route' => 'home',
    /**
     * Enable Username
     * Enables username field on the registration form, and allows users to log
     * in using their username OR email address. Default is false.
     * Accepted values: boolean true or false
     */
    'enable_username' => true,
42
    /**     
Bertrand Gauthier's avatar
Bertrand Gauthier committed
43
44
45
46
47
48
     * Enable Display Name
     * Enables a display name field on the registration form, which is persisted
     * in the database. Default value is false.
     * Accepted values: boolean true or false
     */
    'enable_display_name' => true,
Bertrand Gauthier's avatar
Bertrand Gauthier committed
49
50
51
52
53
54
55
56
    /**     
     * Authentication Adapters
     * Specify the adapters that will be used to try and authenticate the user
     * Default value: array containing 'ZfcUser\Authentication\Adapter\Db' with priority 100
     * Accepted values: array containing services that implement 'ZfcUser\Authentication\Adapter\ChainableAdapter'
     */
    'auth_adapters' => array(
        300 => 'UnicaenAuth\Authentication\Adapter\Ldap', // notifié en 1er
57
        200 => 'UnicaenAuth\Authentication\Adapter\Db',   //         ensuite (si échec d'authentification Ldap)
Bertrand Gauthier's avatar
Bertrand Gauthier committed
58
        100 => 'UnicaenAuth\Authentication\Adapter\Cas',  //         ensuite (si échec d'authentification Db)
Bertrand Gauthier's avatar
Bertrand Gauthier committed
59
    ),
Bertrand Gauthier's avatar
Bertrand Gauthier committed
60
);
61

62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
$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
     * roles the "identity role" should inherit from.
     *
     * for ZfcUser, this will be your default identity provider
     */
    'identity_provider' => 'UnicaenAuth\Provider\Identity\LdapPeople',
    
    /* role providers simply provide a list of roles that should be inserted
     * into the Zend\Acl instance. the module comes with two providers, one
     * to specify roles in a config file and one to load roles using a
     * Zend\Db adapter.
     */
    'role_providers' => array(
        /* here, 'guest' and 'user are defined as top-level roles, with
         * 'admin' inheriting from user
         */
        'BjyAuthorize\Provider\Role\Config' => array(
            'guest' => array(), // rôle par défaut
//            'user'  => array('children' => array(
//                'admin' => array(),
//            )),
        ),
    ),

    // strategy service name for the strategy listener to be used when permission-related errors are detected
    'unauthorized_strategy' => 'BjyAuthorize\View\RedirectionStrategy',
        
    /* Currently, only controller and route guards exist
     */
    'guards' => array(
        /* If this guard is specified here (i.e. it is enabled), it will block
         * access to all controllers and actions unless they are specified here.
         * You may omit the 'action' index to allow access to the entire controller
         */
        'BjyAuthorize\Guard\Controller' => array(
            array('controller' => 'index', 'action' => 'index',                                 'roles' => array('guest')),
            array('controller' => 'zfcuser',                                                    'roles' => array('guest')),
            array('controller' => 'Application\Controller\Index',                               'roles' => array('guest')),

            array('controller' => 'UnicaenApp\Controller\Application:etab',                     'roles' => array('guest')),
            array('controller' => 'UnicaenApp\Controller\Application:apropos',                  'roles' => array('guest')),
            array('controller' => 'UnicaenApp\Controller\Application:contact',                  'roles' => array('guest')),
            array('controller' => 'UnicaenApp\Controller\Application:plan',                     'roles' => array('guest')),
            array('controller' => 'UnicaenApp\Controller\Application:mentions-legales',         'roles' => array('guest')),
            array('controller' => 'UnicaenApp\Controller\Application:informatique-et-libertes', 'roles' => array('guest')),
        ),
    ),
);
Bertrand Gauthier's avatar
Bertrand Gauthier committed
112
113
114

return array(
    'zfcuser' => $zfcuserSettings,
115
    'bjyauthorize' => $bjyauthorize,
Bertrand Gauthier's avatar
Bertrand Gauthier committed
116
    'unicaen-auth' => $settings,
117
118
119
120
121
122
123
124
    'doctrine' => array(
        'entitymanager' => array(
            'orm_auth' => array(
                'connection'    => 'orm_auth',
                'configuration' => 'orm_default'
            )
        ),
    ),
Bertrand Gauthier's avatar
Bertrand Gauthier committed
125
    'service_manager' => array(
126
127
128
        'abstract_factories' => array(
            'UnicaenAuth\Authentication\Adapter\AbstractFactory',
        ),
Bertrand Gauthier's avatar
Bertrand Gauthier committed
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
        'factories' => array(
            'unicaen-auth_module_options' => function(Zend\ServiceManager\ServiceLocatorInterface $serviceLocator) {
                $config = $serviceLocator->get('Config');
                return new UnicaenAuth\Options\ModuleOptions(array_merge($config['zfcuser'], $config['unicaen-auth']));
            },
            'UnicaenAuth\Authentication\Storage\Db' => function() {
                return new UnicaenAuth\Authentication\Storage\Db();
            },
            'UnicaenAuth\Authentication\Storage\Ldap' => function() {
                return new UnicaenAuth\Authentication\Storage\Ldap();
            },
            'UnicaenAuth\Authentication\Storage\LdapDb' => function(Zend\ServiceManager\ServiceLocatorInterface $serviceLocator) {
                $storage = new UnicaenAuth\Authentication\Storage\LdapDb();
                $storage->setLdapStorage($serviceLocator->get('UnicaenAuth\Authentication\Storage\Ldap'))
                        ->setDbStorage(  $serviceLocator->get('UnicaenAuth\Authentication\Storage\Db'));
                return $storage;
            },
            'zfcuser_auth_service' => function (Zend\ServiceManager\ServiceLocatorInterface $serviceLocator) {
                return new \Zend\Authentication\AuthenticationService(
                    $serviceLocator->get('UnicaenAuth\Authentication\Storage\LdapDb'),
                    $serviceLocator->get('ZfcUser\Authentication\Adapter\AdapterChain')
                );
            },
        ),
    ),
154
155
    'controllers' => array(
        'invokables' => array(
156
            
157
158
        ),
    ),
Bertrand Gauthier's avatar
Bertrand Gauthier committed
159
160
    'view_manager' => array(
        'template_path_stack' => array(
161
            'unicaen-auth' => __DIR__ . '/../view',
Bertrand Gauthier's avatar
Bertrand Gauthier committed
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
        ),
    ),
    'translator' => array(
        'translation_file_patterns' => array(
            array(
                'type'     => 'gettext',
                'base_dir' => __DIR__ . '/../language',
                'pattern'  => '%s.mo',
            ),
        ),
    ),
    'router' => array(
        'routes' => array(
            'zfcuser' => array(
                'type' => 'Literal',
                'priority' => 1000,
                'options' => array(
Bertrand Gauthier's avatar
Bertrand Gauthier committed
179
                    'route' => '/auth',
Bertrand Gauthier's avatar
Bertrand Gauthier committed
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
                    'defaults' => array(
                        'controller' => 'zfcuser',
                        'action'     => 'index',
                    ),
                ),
                'may_terminate' => true,
                'child_routes' => array(
                    'login' => array(
                        'type' => 'Literal',
                        'options' => array(
                            'route' => '/connexion',
                            'defaults' => array(
                                'controller' => 'zfcuser',
                                'action'     => 'login',
                            ),
                        ),
                    ),
                    'logout' => array(
                        'type' => 'Literal',
                        'options' => array(
                            'route' => '/deconnexion',
                            'defaults' => array(
                                'controller' => 'zfcuser',
                                'action'     => 'logout',
                            ),
                        ),
                    ),
207
208
209
210
211
212
213
214
215
216
                    'register' => array(
                        'type' => 'Literal',
                        'options' => array(
                            'route' => '/creation-compte',
                            'defaults' => array(
                                'controller' => 'zfcuser',
                                'action'     => 'register',
                            ),
                        ),
                    ),
Bertrand Gauthier's avatar
Bertrand Gauthier committed
217
218
219
220
221
222
223
224
225
226
227
228
                ),
            ),
        ),
    ),
    // All navigation-related configuration is collected in the 'navigation' key
    'navigation' => array(
        // The DefaultNavigationFactory we configured uses 'default' as the sitemap key
        'default' => array(
            // And finally, here is where we define our page hierarchy
            'home' => array(
                'pages' => array(
                    'login' => array(
229
                        'label'    => _("Se connecter"),
Bertrand Gauthier's avatar
Bertrand Gauthier committed
230
231
232
233
                        'route'    => 'zfcuser/login',
                        'visible'  => false,
                    ),
                    'register' => array(
234
                        'label'   => _("S'enregistrer"),
Bertrand Gauthier's avatar
Bertrand Gauthier committed
235
236
237
238
239
240
241
                        'route'   => 'zfcuser/register',
                        'visible' => false,
                    ),
                ),
            ),
        ),
    ),
242
);