Commit 29acec33 authored by Laurent Lécluse's avatar Laurent Lécluse
Browse files

Utilisation de la syntaxe courte pour les tableaux d'UnicaenAuth

parent 6efa4f5e
......@@ -31,16 +31,16 @@ class Module implements ConfigProviderInterface, ViewHelperProviderInterface, Se
*/
public function getAutoloaderConfig()
{
return array(
'Zend\Loader\ClassMapAutoloader' => array(
return [
'Zend\Loader\ClassMapAutoloader' => [
__DIR__ . '/autoload_classmap.php',
),
'Zend\Loader\StandardAutoloader' => array(
'namespaces' => array(
],
'Zend\Loader\StandardAutoloader' => [
'namespaces' => [
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
),
),
);
],
],
];
}
/**
......@@ -73,43 +73,43 @@ class Module implements ConfigProviderInterface, ViewHelperProviderInterface, Se
if ($options->getCas() && php_sapi_name() !== 'cli') {
/* @var $router \Zend\Mvc\Router\Http\TreeRouteStack */
$router = $services->get('router');
$router->addRoutes(array(
$router->addRoutes([
// remplace les routes existantes (cf. config du module)
'zfcuser' => array(
'zfcuser' => [
'type' => 'Literal',
'priority' => 1000,
'options' => array(
'options' => [
'route' => '/auth',
'defaults' => array(
'defaults' => [
'controller' => 'zfcuser',
'action' => 'index',
),
),
],
],
'may_terminate' => true,
'child_routes' => array(
'login' => array(
'child_routes' => [
'login' => [
'type' => 'Literal',
'options' => array(
'options' => [
'route' => '/connexion',
'defaults' => array(
'defaults' => [
'controller' => 'zfcuser',
'action' => 'authenticate', // zappe l'action 'login'
),
),
),
'logout' => array(
],
],
],
'logout' => [
'type' => 'Literal',
'options' => array(
'options' => [
'route' => '/deconnexion',
'defaults' => array(
'defaults' => [
'controller' => 'zfcuser',
'action' => 'logout',
),
),
),
),
)
));
],
],
],
],
]
]);
}
}
......@@ -120,8 +120,8 @@ class Module implements ConfigProviderInterface, ViewHelperProviderInterface, Se
*/
public function getViewHelperConfig()
{
return array(
'factories' => array(
return [
'factories' => [
'userConnection' => 'UnicaenAuth\View\Helper\UserConnectionFactory',
'userCurrent' => 'UnicaenAuth\View\Helper\UserCurrentFactory',
'userStatus' => 'UnicaenAuth\View\Helper\UserStatusFactory',
......@@ -129,11 +129,11 @@ class Module implements ConfigProviderInterface, ViewHelperProviderInterface, Se
'userInfo' => 'UnicaenAuth\View\Helper\UserInfoFactory',
'userProfileSelect' => 'UnicaenAuth\View\Helper\UserProfileSelectFactory',
'userProfileSelectRadioItem' => 'UnicaenAuth\View\Helper\UserProfileSelectRadioItemFactory',
),
'invokables' => array(
],
'invokables' => [
'appConnection' => 'UnicaenAuth\View\Helper\AppConnection',
),
);
],
];
}
/**
......@@ -143,8 +143,8 @@ class Module implements ConfigProviderInterface, ViewHelperProviderInterface, Se
*/
public function getServiceConfig()
{
return array(
'factories' => array(
return [
'factories' => [
// verrue pour forcer le label de l'identifiant qqsoit l'options 'auth_identity_fields'
'zfcuser_login_form' => function($sm) {
$options = $sm->get('zfcuser_module_options');
......@@ -153,7 +153,7 @@ class Module implements ConfigProviderInterface, ViewHelperProviderInterface, Se
$form->get('identity')->setLabel("Username");
return $form;
},
),
);
],
];
}
}
\ No newline at end of file
<?php
// Generated by ZF2's ./bin/classmap_generator.php
return array(
return [
'UnicaenAuth\Service\User' => __DIR__ . '/src/UnicaenAuth/Service/User.php',
'UnicaenAuth\Authentication\Storage\Ldap' => __DIR__ . '/src/UnicaenAuth/Authentication/Storage/Ldap.php',
'UnicaenAuth\Authentication\Storage\Db' => __DIR__ . '/src/UnicaenAuth/Authentication/Storage/Db.php',
......@@ -21,4 +21,4 @@ return array(
'UnicaenAuth\View\Helper\UserConnection' => __DIR__ . '/src/UnicaenAuth/View/Helper/UserConnection.php',
'UnicaenAuth\View\Helper\UserAbstract' => __DIR__ . '/src/UnicaenAuth/View/Helper/UserAbstract.php',
'UnicaenAuth\Module' => __DIR__ . '/Module.php',
);
\ No newline at end of file
];
\ No newline at end of file
<?php
$settings = array(
$settings = [
/**
* Fournisseurs d'identité.
*/
'identity_providers' => array(
'identity_providers' => [
300 => 'UnicaenAuth\Provider\Identity\Basic', // en 1er
200 => 'UnicaenAuth\Provider\Identity\Db', // en 2e
100 => 'UnicaenAuth\Provider\Identity\Ldap', // en 3e
),
);
],
];
$zfcuserSettings = array(
$zfcuserSettings = [
/**
* Enable registration
* Allows users to register through the website.
......@@ -24,7 +24,7 @@ $zfcuserSettings = array(
* Default value: array containing 'email'
* Accepted values: array containing one or more of: email, username
*/
'auth_identity_fields' => array('username', 'email'),
'auth_identity_fields' => ['username', 'email'],
/**
* Login Redirect Route
* Upon successful login the user will be redirected to the entered route
......@@ -59,19 +59,19 @@ $zfcuserSettings = array(
* 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(
'auth_adapters' => [
300 => 'UnicaenAuth\Authentication\Adapter\Ldap', // notifié en 1er
200 => 'UnicaenAuth\Authentication\Adapter\Db', // ensuite (si échec d'authentification Ldap)
100 => 'UnicaenAuth\Authentication\Adapter\Cas', // ensuite (si échec d'authentification Db)
),
],
// telling ZfcUser to use our own class
'user_entity_class' => 'UnicaenAuth\Entity\Db\User',
// telling ZfcUserDoctrineORM to skip the entities it defines
'enable_default_entities' => false,
);
];
$bjyauthorize = array(
$bjyauthorize = [
/* 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.
......@@ -85,33 +85,33 @@ $bjyauthorize = array(
* to specify roles in a config file and one to load roles using a
* Zend\Db adapter.
*/
'role_providers' => array(
'role_providers' => [
/**
* 2 rôles doivent systématiquement exister dans les ACL :
* - le rôle par défaut 'guest', c'est le rôle de tout utilisateur non authentifié.
* - le rôle 'user', c'est le rôle de tout utilisateur authentifié.
*/
'UnicaenAuth\Provider\Role\Config' => array(
'guest' => array('name' => "Non authentifié(e)", 'selectable' => false, 'children' => array(
'user' => array('name' => "Authentifié(e)", 'selectable' => false)
)),
),
'UnicaenAuth\Provider\Role\Config' => [
'guest' => ['name' => "Non authentifié(e)", 'selectable' => false, 'children' => [
'user' => ['name' => "Authentifié(e)", 'selectable' => false]
]],
],
/**
* Fournit les rôles issus de la base de données éventuelle de l'appli.
* NB: si le rôle par défaut 'guest' est fourni ici, il ne sera pas ajouté en double dans les ACL.
* NB: si la connexion à la base échoue, ce n'est pas bloquant!
*/
'UnicaenAuth\Provider\Role\DbRole' => array(
'UnicaenAuth\Provider\Role\DbRole' => [
'object_manager' => 'doctrine.entitymanager.orm_default',
'role_entity_class' => 'UnicaenAuth\Entity\Db\Role',
),
],
/**
* Fournit le rôle correspondant à l'identifiant de connexion de l'utilisateur.
* Cela est utile lorsque l'on veut gérer les habilitations d'un utilisateur unique
* sur des ressources.
*/
'UnicaenAuth\Provider\Role\Username' => array(),
),
'UnicaenAuth\Provider\Role\Username' => [],
],
// strategy service name for the strategy listener to be used when permission-related errors are detected
// 'unauthorized_strategy' => 'BjyAuthorize\View\RedirectionStrategy',
......@@ -119,72 +119,72 @@ $bjyauthorize = array(
/* Currently, only controller and route guards exist
*/
'guards' => array(
'guards' => [
/* 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()),
array('controller' => 'zfcuser', 'roles' => array()),
array('controller' => 'Application\Controller\Index', 'roles' => array()),
'BjyAuthorize\Guard\Controller' => [
['controller' => 'index', 'action' => 'index', 'roles' => []],
['controller' => 'zfcuser', 'roles' => []],
['controller' => 'Application\Controller\Index', 'roles' => []],
array('controller' => 'UnicaenApp\Controller\Application', 'action' => 'etab', 'roles' => array()),
array('controller' => 'UnicaenApp\Controller\Application', 'action' => 'apropos', 'roles' => array()),
array('controller' => 'UnicaenApp\Controller\Application', 'action' => 'contact', 'roles' => array()),
array('controller' => 'UnicaenApp\Controller\Application', 'action' => 'plan', 'roles' => array()),
array('controller' => 'UnicaenApp\Controller\Application', 'action' => 'mentions-legales', 'roles' => array()),
array('controller' => 'UnicaenApp\Controller\Application', 'action' => 'informatique-et-libertes', 'roles' => array()),
array('controller' => 'UnicaenApp\Controller\Application', 'action' => 'refresh-session', 'roles' => array()),
array('controller' => 'UnicaenAuth\Controller\Utilisateur', 'action' => 'selectionner-profil', 'roles' => array()),
),
),
);
['controller' => 'UnicaenApp\Controller\Application', 'action' => 'etab', 'roles' => []],
['controller' => 'UnicaenApp\Controller\Application', 'action' => 'apropos', 'roles' => []],
['controller' => 'UnicaenApp\Controller\Application', 'action' => 'contact', 'roles' => []],
['controller' => 'UnicaenApp\Controller\Application', 'action' => 'plan', 'roles' => []],
['controller' => 'UnicaenApp\Controller\Application', 'action' => 'mentions-legales', 'roles' => []],
['controller' => 'UnicaenApp\Controller\Application', 'action' => 'informatique-et-libertes', 'roles' => []],
['controller' => 'UnicaenApp\Controller\Application', 'action' => 'refresh-session', 'roles' => []],
['controller' => 'UnicaenAuth\Controller\Utilisateur', 'action' => 'selectionner-profil', 'roles' => []],
],
],
];
return array(
return [
'zfcuser' => $zfcuserSettings,
'bjyauthorize' => $bjyauthorize,
'unicaen-auth' => $settings,
'doctrine' => array(
'driver' => array(
'doctrine' => [
'driver' => [
// overriding zfc-user-doctrine-orm's config
'zfcuser_entity' => array(
'zfcuser_entity' => [
'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
'paths' => array(
'paths' => [
__DIR__ . '/../src/UnicaenAuth/Entity/Db'
)
),
'orm_auth_driver' => array(
]
],
'orm_auth_driver' => [
'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
'cache' => 'array',
'paths' => array(
'paths' => [
__DIR__ . '/../src/UnicaenAuth/Entity/Db'
)
),
'orm_default' => array(
]
],
'orm_default' => [
'class' => 'Doctrine\ORM\Mapping\Driver\DriverChain',
'drivers' => array(
'drivers' => [
'UnicaenAuth\Entity\Db' => 'zfcuser_entity',
'UnicaenAuth\Entity\Db' => 'orm_auth_driver'
)
),
),
),
'service_manager' => array(
'aliases' => array(
]
],
],
],
'service_manager' => [
'aliases' => [
'Zend\Authentication\AuthenticationService' => 'zfcuser_auth_service',
),
'invokables' => array(
],
'invokables' => [
'unicaen-auth_user_service' => 'UnicaenAuth\Service\User',
'UnicaenAuth\Authentication\Storage\Db' => 'UnicaenAuth\Authentication\Storage\Db',
'UnicaenAuth\Authentication\Storage\Ldap' => 'UnicaenAuth\Authentication\Storage\Ldap',
'UnicaenAuth\View\RedirectionStrategy' => 'UnicaenAuth\View\RedirectionStrategy',
'authUserContext' => 'UnicaenAuth\Service\UserContext'
),
'abstract_factories' => array(
],
'abstract_factories' => [
'UnicaenAuth\Authentication\Adapter\AbstractFactory',
),
'factories' => array(
],
'factories' => [
'unicaen-auth_module_options' => 'UnicaenAuth\Options\ModuleOptionsFactory',
'zfcuser_auth_service' => 'UnicaenAuth\Authentication\AuthenticationServiceFactory',
'UnicaenAuth\Authentication\Storage\Chain' => 'UnicaenAuth\Authentication\Storage\ChainServiceFactory',
......@@ -195,127 +195,127 @@ return array(
'UnicaenAuth\Provider\Role\Config' => 'UnicaenAuth\Provider\Role\ConfigServiceFactory',
'UnicaenAuth\Provider\Role\DbRole' => 'UnicaenAuth\Provider\Role\DbRoleServiceFactory',
'UnicaenAuth\Provider\Role\Username' => 'UnicaenAuth\Provider\Role\UsernameServiceFactory',
),
'initializers' => array(
],
'initializers' => [
'UnicaenAuth\Service\UserAwareInitializer',
),
),
'controllers' => array(
'invokables' => array(
],
],
'controllers' => [
'invokables' => [
'UnicaenAuth\Controller\Utilisateur' => 'UnicaenAuth\Controller\UtilisateurController',
),
),
'view_manager' => array(
'template_map' => array(
],
],
'view_manager' => [
'template_map' => [
'error/403' => __DIR__ . '/../view/error/403.phtml',
),
'template_path_stack' => array(
],
'template_path_stack' => [
'unicaen-auth' => __DIR__ . '/../view',
),
),
'translator' => array(
'translation_file_patterns' => array(
array(
],
],
'translator' => [
'translation_file_patterns' => [
[
'type' => 'gettext',
'base_dir' => __DIR__ . '/../language',
'pattern' => '%s.mo',
),
),
),
'router' => array(
'routes' => array(
'zfcuser' => array(
],
],
],
'router' => [
'routes' => [
'zfcuser' => [
'type' => 'Literal',
'priority' => 1000,
'options' => array(
'options' => [
'route' => '/auth',
'defaults' => array(
'defaults' => [
'controller' => 'zfcuser',
'action' => 'index',
),
),
],
],
'may_terminate' => true,
'child_routes' => array(
'login' => array(
'child_routes' => [
'login' => [
'type' => 'Literal',
'options' => array(
'options' => [
'route' => '/connexion',
'defaults' => array(
'defaults' => [
'controller' => 'zfcuser',
'action' => 'login',
),
),
),
'logout' => array(
],
],
],
'logout' => [
'type' => 'Literal',
'options' => array(
'options' => [
'route' => '/deconnexion',
'defaults' => array(
'defaults' => [
'controller' => 'zfcuser',
'action' => 'logout',
),
),
),
'register' => array(
],
],
],
'register' => [
'type' => 'Literal',
'options' => array(
'options' => [
'route' => '/creation-compte',
'defaults' => array(
'defaults' => [
'controller' => 'zfcuser',
'action' => 'register',
),
),
),
),
),
'utilisateur' => array(
],
],
],
],
],
'utilisateur' => [
'type' => 'Literal',
'options' => array(
'options' => [
'route' => '/utilisateur',
'defaults' => array(
'defaults' => [
'__NAMESPACE__' => 'UnicaenAuth\Controller',
'controller' => 'Utilisateur',
'action' => 'index',
),
),
],
],
'may_terminate' => true,
'child_routes' => array(
'default' => array(
'child_routes' => [
'default' => [
'type' => 'Segment',
'options' => array(
'options' => [
'route' => '/:action[/:id]',
'constraints' => array(
'constraints' => [
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]*',
),
'defaults' => array(
],
'defaults' => [
'action' => 'index',
),
),
),
),
),
),
),
],
],
],
],
],
],
],
// All navigation-related configuration is collected in the 'navigation' key
'navigation' => array(
'navigation' => [
// The DefaultNavigationFactory we configured uses 'default' as the sitemap key
'default' => array(
'default' => [
// And finally, here is where we define our page hierarchy
'home' => array(
'pages' => array(
'login' => array(
'home' => [
'pages' => [
'login' => [
'label' => _("Connexion"),
'route' => 'zfcuser/login',
'visible' => false,
),
'register' => array(
],
'register' => [
'label' => _("Enregistrement"),
'route' => 'zfcuser/register',
'visible' => false,
),
),
),
),
),
);
\ No newline at end of file
],
],
],
],
],
];
\ No newline at end of file
......@@ -5,7 +5,7 @@
* If you have a ./config/autoload/ directory set up for your project, you can
* drop this config file in it and change the values as you wish.
*/
$settings = array(
$settings = [
/**
* Flag indiquant si l'utilisateur authenitifié avec succès via l'annuaire LDAP doit
* être enregistré/mis à jour dans la table des utilisateurs de l'appli.
......@@ -16,14 +16,14 @@ $settings = array(
* (i.e. créer un compte dans la table des utilisateurs).
*/
'enable_registration' => false,
);
];
/**
* You do not need to edit below this line
*/
return array(
return [
'unicaen-auth' => $settings,
'zfcuser' => array(
'zfcuser' => [
'enable_registration' => isset($settings['enable_registration']) ? $settings['enable_registration'] : false,
),
);
\ No newline at end of file
],
];
\ No newline at end of file
......@@ -5,13 +5,13 @@
* If you have a ./config/autoload/ directory set up for your project, you can
* drop this config file in it and change the values as you wish.
*/
$settings = array(
$settings = [
/**
* Paramètres de connexion au serveur CAS :
* - pour désactiver l'authentification CAS, le tableau 'cas' doit être vide.