diff --git a/config/autoload/unicaen-app.global.php b/config/autoload/unicaen-app.global.php new file mode 100644 index 0000000000000000000000000000000000000000..721e17758d75fecc6a015b564fce5430885421b2 --- /dev/null +++ b/config/autoload/unicaen-app.global.php @@ -0,0 +1,91 @@ +<?php +/** + * Configuration globale du module UnicaenApp. + * + * Copiez ce fichier dans le répertoire "config/autoload" de l'application, + * enlevez l'extension ".dist" et adaptez son contenu à vos besoins. + */ + +use Zend\Session\Storage\SessionArrayStorage; +use Zend\Session\Validator\HttpUserAgent; +use Zend\Session\Validator\RemoteAddr; + +return [ + 'unicaen-app' => [ + + /** + * Informations concernant cette application + */ + 'app_infos' => [ + 'nom' => "NomDeVotreApplication", + 'desc' => "Description succincte de votre application", + 'version' => "0.0.1", + 'date' => "07/11/2017", + 'contact' => ['mail' => "dsi.applications@unicaen.fr", /*'tel' => "01 02 03 04 05"*/], + 'mentionsLegales' => "http://www.unicaen.fr/acces-direct/mentions-legales/", + 'informatiqueEtLibertes' => "http://www.unicaen.fr/acces-direct/informatique-et-libertes/", + ], + + /** + * Période d'exécution de la requête de rafraîchissement de la session utilisateur, en millisecondes. + */ + 'session_refresh_period' => 0, // 0 <=> aucune requête exécutée + + /** + * Paramètres de fonctionnement LDAP. + */ + 'ldap' => [ + 'dn' => [ + 'UTILISATEURS_BASE_DN' => 'ou=people,dc=unicaen,dc=fr', + 'UTILISATEURS_DESACTIVES_BASE_DN' => 'ou=deactivated,dc=unicaen,dc=fr', + 'GROUPS_BASE_DN' => 'ou=groups,dc=unicaen,dc=fr', + 'STRUCTURES_BASE_DN' => 'ou=structures,dc=unicaen,dc=fr', + ], + 'filters' => [ + 'LOGIN_FILTER' => '(supannAliasLogin=%s)', + 'UTILISATEUR_STD_FILTER' => '(|(uid=p*)(&(uid=e*)(eduPersonAffiliation=student)))', + 'CN_FILTER' => '(cn=%s)', + 'NAME_FILTER' => '(cn=%s*)', + 'UID_FILTER' => '(uid=%s)', + 'NO_INDIVIDU_FILTER' => '(supannEmpId=%08s)', + 'AFFECTATION_FILTER' => '(&(uid=*)(eduPersonOrgUnitDN=%s))', + 'AFFECTATION_CSTRUCT_FILTER' => '(&(uid=*)(|(ucbnSousStructure=%s;*)(supannAffectation=%s;*)))', + 'LOGIN_OR_NAME_FILTER' => '(|(supannAliasLogin=%s)(cn=%s*))', + 'MEMBERSHIP_FILTER' => '(memberOf=%s)', + 'AFFECTATION_ORG_UNIT_FILTER' => '(eduPersonOrgUnitDN=%s)', + 'AFFECTATION_ORG_UNIT_PRIMARY_FILTER' => '(eduPersonPrimaryOrgUnitDN=%s)', + 'ROLE_FILTER' => '(supannRoleEntite=[role={SUPANN}%s][type={SUPANN}%s][code=%s]*)', + 'PROF_STRUCTURE' => '(&(eduPersonAffiliation=teacher)(eduPersonOrgUnitDN=%s))', + 'FILTER_STRUCTURE_DN' => '(%s)', + 'FILTER_STRUCTURE_CODE_ENTITE' => '(supannCodeEntite=%s)', + 'FILTER_STRUCTURE_CODE_ENTITE_PARENT' => '(supannCodeEntiteParent=%s)', + ], + ], + ], + + // + // Session configuration. + // + 'session_config' => [ + // Session cookie will expire in 1 hour. + 'cookie_lifetime' => 60*60*1, + // Session data will be stored on server maximum for 30 days. + 'gc_maxlifetime' => 60*60*24*30, + ], + // + // Session manager configuration. + // + 'session_manager' => [ + // Session validators (used for security). + 'validators' => [ + RemoteAddr::class, + HttpUserAgent::class, + ] + ], + // + // Session storage configuration. + // + 'session_storage' => [ + 'type' => SessionArrayStorage::class + ], +]; diff --git a/config/autoload/unicaen-auth.global.php b/config/autoload/unicaen-auth.global.php new file mode 100644 index 0000000000000000000000000000000000000000..1c4e762bc5bb66c6d25a79139aa07568d0dad0a4 --- /dev/null +++ b/config/autoload/unicaen-auth.global.php @@ -0,0 +1,198 @@ +<?php +/** + * UnicaenAuth Global Configuration + * + * 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 = [ + + /** + * Configuration de l'authentification locale. + */ + 'local' => [ + /** + * Affichage ou non du formulaire d'authentification avec un compte local. + */ + 'enabled' => true, + ], + + /** + * Configuration de l'authentification LDAP. + */ + 'ldap' => [ + /** + * Affichage ou non du formulaire d'authentification via l'annuaire LDAP. + * NB: en réalité cela permet aussi l'authentification avec un compte local. + */ + 'enabled' => true, + ], + + /** + * 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. + */ + 'save_ldap_user_in_database' => false, + + 'enable_privileges' => true, + + 'entity_manager_name' => 'doctrine.entitymanager.orm_default', // nom du gestionnaire d'entités à utiliser + + /** + * Attribut LDAP utilisé pour le username des utilisateurs + * A personnaliser au besoin + */ + //'ldap_username' => 'supannaliaslogin', +]; + +$config = [ + 'unicaen-auth' => $settings, + + '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. + * + * for ZfcUser, this will be your default identity provider + */ + 'identity_provider' => 'UnicaenAuth\Provider\Identity\Chain', + + /* 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' => [ + /** + * 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' => [], + /** + * 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' => [], + ], + ], + + 'zfcuser' => [ + /** + * Classe de l'entité représentant un utilisateur authentifiable. + * Décommenter pour spécifier une autre classe que celle par défaut (\UnicaenAuth\Entity\Db\User). + * NB: la classe spécifiée doit hériter de \UnicaenAuth\Entity\Db\AbstractUser. + */ + //'user_entity_class' => \Application\Entity\Db\Utilisateur::class, // exemple + + /** + * Enable registration + * Allows users to register through the website. + * Accepted values: boolean true or false + */ + 'enable_registration' => false, + ], +]; + +if ($settings['enable_privileges']) { + $privileges = [ + 'unicaen-auth' => [ + /** + * Classes représentant les entités rôle et privilège. + * - Entité rôle : héritant de \UnicaenAuth\Entity\Db\AbstractRole ou implémentant \UnicaenAuth\Entity\Db\RoleInterface. + * - Entité privilège : héritant de \UnicaenAuth\Entity\Db\AbstractPrivilege ou implémentant \UnicaenAuth\Entity\Db\PrivilegeInterface. + * + * Valeurs par défaut : + * - 'role_entity_class' : 'UnicaenAuth\Entity\Db\Role' + * - 'privilege_entity_class' : 'UnicaenAuth\Entity\Db\Privilege' + */ + 'role_entity_class' => 'UnicaenAuth\Entity\Db\Role', + 'privilege_entity_class' => 'UnicaenAuth\Entity\Db\Privilege', + ], + + 'bjyauthorize' => [ + + 'resource_providers' => [ + /** + * Le service Privilèges peut aussi être une source de ressources, + * si on souhaite tester directement l'accès à un privilège + */ + 'UnicaenAuth\Service\Privilege' => [], + ], + + 'rule_providers' => [ + 'UnicaenAuth\Provider\Rule\PrivilegeRuleProvider' => [], + ], + + 'guards' => [ + 'UnicaenAuth\Guard\PrivilegeController' => [ + [ + 'controller' => 'UnicaenAuth\Controller\Droits', + 'action' => ['index'], + 'privileges' => [ + \UnicaenAuth\Provider\Privilege\Privileges::DROIT_ROLE_VISUALISATION, + \UnicaenAuth\Provider\Privilege\Privileges::DROIT_PRIVILEGE_VISUALISATION, + ], + ], + [ + 'controller' => 'UnicaenAuth\Controller\Droits', + 'action' => ['roles'], + 'privileges' => [\UnicaenAuth\Provider\Privilege\Privileges::DROIT_ROLE_VISUALISATION], + ], + [ + 'controller' => 'UnicaenAuth\Controller\Droits', + 'action' => ['privileges'], + 'privileges' => [\UnicaenAuth\Provider\Privilege\Privileges::DROIT_PRIVILEGE_VISUALISATION], + ], + [ + 'controller' => 'UnicaenAuth\Controller\Droits', + 'action' => ['role-edition', 'role-suppression'], + 'privileges' => [\UnicaenAuth\Provider\Privilege\Privileges::DROIT_ROLE_EDITION], + ], + [ + 'controller' => 'UnicaenAuth\Controller\Droits', + 'action' => ['privileges-modifier'], + 'privileges' => [\UnicaenAuth\Provider\Privilege\Privileges::DROIT_PRIVILEGE_EDITION], + ], + ], + ], + ], + 'navigation' => [ + // The DefaultNavigationFactory we configured uses 'default' as the sitemap key + 'default' => [ + // And finally, here is where we define our page hierarchy + 'home' => [ + 'pages' => [ + 'droits' => [ + 'label' => 'Droits d\'accès', + 'title' => 'Gestion des droits d\'accès', + 'route' => 'droits', + 'resource' => \UnicaenAuth\Guard\PrivilegeController::getResourceId('UnicaenAuth\Controller\Droits', 'index'), + 'pages' => [ + 'roles' => [ + 'label' => "Rôles", + 'title' => "Gestion des rôles", + 'route' => 'droits/roles', + 'resource' => \UnicaenAuth\Guard\PrivilegeController::getResourceId('UnicaenAuth\Controller\Droits', 'roles'), + 'withtarget' => true, + ], + 'privileges' => [ + 'label' => "Privilèges", + 'title' => "Gestion des privilèges", + 'route' => 'droits/privileges', + 'resource' => \UnicaenAuth\Guard\PrivilegeController::getResourceId('UnicaenAuth\Controller\Droits', 'privileges'), + 'withtarget' => true, + ], + ], + ], + ], + ], + ], + ], + ]; +} else { + $privileges = []; +} + +return array_merge_recursive($config, $privileges); \ No newline at end of file diff --git a/config/autoload/unicaen-code.global.php b/config/autoload/unicaen-code.global.php new file mode 100644 index 0000000000000000000000000000000000000000..c932d861ae36f0d1f0f754af112703fba3700b6b --- /dev/null +++ b/config/autoload/unicaen-code.global.php @@ -0,0 +1,25 @@ +<?php + +$settings = [ + 'view-dirs' => [getcwd() . '/code'], + 'template-dirs' => [getcwd() . '/code/template'], + 'generator-output-dir' => '/tmp/UnicaenCode', + 'namespaces' => [ + 'services' => [ + 'Application', + ], + 'forms' => [ + 'Application\Form', + ], + 'hydrators' => [ + 'Application\Hydrator', + ], + 'entities' => [ + 'Application\Entity\Db', + ], + ], +]; + +return [ + 'unicaen-code' => $settings, +]; \ No newline at end of file