diff --git a/config.local.php.default b/config.local.php.default index e910c209fcca3f2c4863828ffafe8c8dcabe48bd..30b43408b4625f308b26def016916cc9d43c7f96 100755 --- a/config.local.php.default +++ b/config.local.php.default @@ -128,6 +128,9 @@ return [ /* Configuration LDAP */ 'ldap' => [ + /* Actif (si non, alors seuls les comptes locaux seront autorisés à se connecter à OSE) */ + 'actif' => true, + /* IP ou nom DNS de la machine hébergeant le serveur LDAP */ 'host' => 'ldap.unicaen.fr', diff --git a/config/application.config.php b/config/application.config.php index ddb4efe5964447cff1bbeeb5d055b919b8c6db41..b414fcca392e85aff82f5b9857fc99173e851eb0 100755 --- a/config/application.config.php +++ b/config/application.config.php @@ -80,7 +80,6 @@ class AppConfig if ('development' == $env) { $modules[] = 'ZendDeveloperTools'; - $configGlobPaths[] = 'config/autoload/{,*.}{global,local}.php.dev'; } if (self::inConsole() || 'development' == $env){ diff --git a/config/autoload/application.global.php b/config/autoload/application.global.php index 43c1eeaf55be5520c2b8cce2e5746e24a271fe21..072cb56c2549dacac6de6cfc7fcee9bb81e6ec90 100755 --- a/config/autoload/application.global.php +++ b/config/autoload/application.global.php @@ -5,12 +5,12 @@ return [ 'connection' => [ 'orm_default' => [ 'params' => [ - 'host' => AppConfig::get('bdd','host'), - 'port' => AppConfig::get('bdd','port'), - 'dbname' => AppConfig::get('bdd','dbname'), - 'user' => AppConfig::get('bdd','username'), - 'password' => AppConfig::get('bdd','password'), - 'charset' => 'AL32UTF8', + 'host' => AppConfig::get('bdd', 'host'), + 'port' => AppConfig::get('bdd', 'port'), + 'dbname' => AppConfig::get('bdd', 'dbname'), + 'user' => AppConfig::get('bdd', 'username'), + 'password' => AppConfig::get('bdd', 'password'), + 'charset' => 'AL32UTF8', 'persistent' => true, ], ], @@ -19,20 +19,20 @@ return [ 'orm_default' => [ 'metadata_cache' => 'array', // 'query_cache' => 'array', - 'result_cache' => 'array', + 'result_cache' => 'filesystem', 'hydration_cache' => 'array', - 'generate_proxies' => AppConfig::get('bdd','generateProxies'), + 'generate_proxies' => AppConfig::get('bdd', 'generateProxies'), 'proxy_dir' => 'data/cache/DoctrineProxy', ], ], ], 'view_manager' => [ - 'display_not_found_reason' => AppConfig::get('global','affichageErreurs'), - 'display_exceptions' => AppConfig::get('global','affichageErreurs'), + 'display_not_found_reason' => AppConfig::get('global', 'affichageErreurs'), + 'display_exceptions' => AppConfig::get('global', 'affichageErreurs'), ], 'cli_config' => [ - 'scheme' => AppConfig::get('global','scheme'), - 'domain' => AppConfig::get('global','domain'), + 'scheme' => AppConfig::get('global', 'scheme'), + 'domain' => AppConfig::get('global', 'domain'), ], ]; \ No newline at end of file diff --git a/config/autoload/unicaen-app.global.php b/config/autoload/unicaen-app.global.php index e138b29f7ef3ae4b84c5a0184559b4d3e8c2488a..0e2830e880a4ba9bce1f16903aa97ee4bd77ee18 100755 --- a/config/autoload/unicaen-app.global.php +++ b/config/autoload/unicaen-app.global.php @@ -31,7 +31,7 @@ return [ 'connection' => [ 'default' => [ 'params' => [ - 'host' => AppConfig::get('ldap', 'host'), + 'host' => AppConfig::get('ldap', 'actif', true) ? AppConfig::get('ldap', 'host') : null, 'username' => AppConfig::get('ldap', 'username'), 'password' => AppConfig::get('ldap', 'password'), 'baseDn' => AppConfig::get('ldap', 'baseDn'), diff --git a/config/autoload/unicaen-auth.global.php b/config/autoload/unicaen-auth.global.php index c0ce803550db90f224b96d81746d3eb96258052d..49030e63621000cdb4d14dd243ef004aa0344d18 100755 --- a/config/autoload/unicaen-auth.global.php +++ b/config/autoload/unicaen-auth.global.php @@ -41,7 +41,7 @@ $settings = [ /** * Possibilité ou non de s'authentifier à l'aide d'un compte local. */ - 'enabled' => false, + 'enabled' => !AppConfig::get('ldap', 'actif', true), ], /** @@ -51,7 +51,7 @@ $settings = [ /** * Possibilité ou non de s'authentifier via l'annuaire LDAP ET en local!!. */ - 'enabled' => true, + 'enabled' => AppConfig::get('ldap', 'actif', true), ], /** diff --git a/config/autoload/zenddevelopertools.dev.php b/config/autoload/zenddevelopertools.dev.php index 76e140db843d4f5222bd986d510d7c9ce930c93c..ed016e4d4417c1e7425650c20edb623fe27ef634 100644 --- a/config/autoload/zenddevelopertools.dev.php +++ b/config/autoload/zenddevelopertools.dev.php @@ -153,7 +153,7 @@ return array( 'doctrine.mapping_collector.orm_default' => false, //'bjy_authorize_role_collector' => false, //'request' => false, - 'memory' => false, + //'memory' => false, ) ) ) diff --git a/module/Application/config/aaa_module.config.php b/module/Application/config/aaa_module.config.php index da68953b3831fd3be3870fa40eab3bbb4a2943a3..69e105b7354695819d5caefde69045aca67cf88f 100755 --- a/module/Application/config/aaa_module.config.php +++ b/module/Application/config/aaa_module.config.php @@ -47,20 +47,23 @@ $config = [ ], ], 'cache' => [ - 'apc' => [ + 'apc' => [ 'namespace' => 'OSE__' . __NAMESPACE__, ], + 'filesystem' => [ + 'directory' => getcwd().'/data/cache/Doctrine', + ], ], ], 'zfcuser' => [ 'user_entity_class' => Entity\Db\Utilisateur::class, ], - 'translator' => [ + 'translator' => [ 'locale' => \AppConfig::get('global', 'locale'), 'translation_file_patterns' => [ [ 'type' => 'gettext', - 'base_dir' => getcwd().'/language', + 'base_dir' => getcwd() . '/language', 'pattern' => '%s.mo', ], ], @@ -236,7 +239,7 @@ $config = [ ], ]; -if ($customCss = \AppConfig::get('etablissement', 'css')){ +if ($customCss = \AppConfig::get('etablissement', 'css')) { $config['public_files']['stylesheets']['999_'] = $customCss; } diff --git a/module/Application/src/Application/Controller/DroitsController.php b/module/Application/src/Application/Controller/DroitsController.php index f77eb870a2937a0630a6531ea4fe0ebff10cff62..6aa7d05ebe2ae698394e093d915940e6603db611 100755 --- a/module/Application/src/Application/Controller/DroitsController.php +++ b/module/Application/src/Application/Controller/DroitsController.php @@ -6,6 +6,7 @@ use Application\Cache\Traits\CacheContainerTrait; use Application\Entity\Db\Affectation; use Application\Entity\Db\Role; use Application\Form\Droits\Traits\AffectationFormAwareTrait; +use Application\Provider\Role\RoleProvider; use Application\Service\PrivilegeService; use Application\Service\Traits\AffectationServiceAwareTrait; use Application\Service\Traits\ContextServiceAwareTrait; @@ -15,6 +16,7 @@ use Application\Service\Traits\StatutIntervenantServiceAwareTrait; use Application\Service\Traits\StructureServiceAwareTrait; use Application\Form\Droits\Traits\RoleFormAwareTrait; use Application\Service\Traits\UtilisateurServiceAwareTrait; +use Application\Traits\DoctrineCacheAwareTrait; use UnicaenAuth\Service\Traits\PrivilegeServiceAwareTrait; use Application\Entity\Db\StatutIntervenant; use UnicaenAuth\Entity\Db\Privilege; @@ -38,6 +40,7 @@ class DroitsController extends AbstractController use AffectationFormAwareTrait; use ContextServiceAwareTrait; use CacheContainerTrait; + use DoctrineCacheAwareTrait; @@ -282,6 +285,7 @@ class DroitsController extends AbstractController } } } + $this->getCacheFilesystem()->delete(RoleProvider::class.'/affectations'); return compact('form', 'title', 'errors'); } @@ -297,6 +301,7 @@ class DroitsController extends AbstractController $form = $this->makeFormSupprimer(function()use($affectation){ $this->getServiceAffectation()->delete($affectation); }); + $this->getCacheFilesystem()->delete(RoleProvider::class.'/affectations'); return compact('affectation', 'title', 'form'); } diff --git a/module/Application/src/Application/Provider/Role/RoleProvider.php b/module/Application/src/Application/Provider/Role/RoleProvider.php index ec437dea4e3520bd2b6311547d92be3f265c41e4..42922bd3b38aa5e31403613da28622fd3850b807 100755 --- a/module/Application/src/Application/Provider/Role/RoleProvider.php +++ b/module/Application/src/Application/Provider/Role/RoleProvider.php @@ -109,7 +109,7 @@ class RoleProvider implements ProviderInterface, EntityManagerAwareInterface // chargement des rôles métiers $query = $this->getEntityManager()->createQuery( - 'SELECT DISTINCT + 'SELECT r, a, s, p FROM Application\Entity\Db\Role r @@ -119,6 +119,9 @@ class RoleProvider implements ProviderInterface, EntityManagerAwareInterface WHERE r.histoDestruction IS NULL' )->setParameter('utilisateur', $utilisateur); + $query->useResultCache(true); + $query->setResultCacheId(__CLASS__.'/affectations'); + $result = $query->getResult(); $rolesPrivileges = $this->getRolesPrivileges(); diff --git a/module/Application/src/Application/Traits/DoctrineCacheAwareTrait.php b/module/Application/src/Application/Traits/DoctrineCacheAwareTrait.php new file mode 100644 index 0000000000000000000000000000000000000000..f55c5d992011879f885853152a7b5f254e876ac4 --- /dev/null +++ b/module/Application/src/Application/Traits/DoctrineCacheAwareTrait.php @@ -0,0 +1,18 @@ +<?php + +namespace Application\Traits; + +use Doctrine\Common\Cache\FilesystemCache; + +trait DoctrineCacheAwareTrait +{ + /** + * Retourne le cache de système de fichiers de Doctrine + * + * @return FilesystemCache + */ + public function getCacheFilesystem(): FilesystemCache + { + return \Application::$container->get('doctrine.cache.filesystem'); + } +} \ No newline at end of file