Loading composer.json +4 −1 Changes for composer.json: 4 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -33,7 +33,10 @@ "minimum-stability": "stable", "config": { "github-protocols": ["https", "ssh"], "secure-http": false "secure-http": false, "platform": { "php": "7.0" } }, "autoload": { "psr-0": { Loading composer.lock +148 −401 File changed.Preview size limit exceeded, changes collapsed. Show changes module/Oscar/Module.php +58 −14 Changes for module/Oscar/Module.php: 58 added lines, 14 removed lines. Original line number Diff line number Diff line Loading @@ -111,10 +111,9 @@ class Module implements ConsoleBannerProviderInterface, ConsoleUsageProviderInte // Envoi des erreurs dans les LOGS $e->getApplication()->getEventManager()->getSharedManager()->attach( '*', 'dispatch.error', function( $e ){ if( $e->getParam('exception') instanceof \Exception ) $e->getApplication()->getServiceManager()->get('Logger')->error($e->getParam('exception')->getMessage()); }); '*', 'dispatch.error', array($this, 'onDispatchError')); // Log des accès $e->getApplication()->getEventManager()->attach('*', function ($e) { Loading @@ -130,6 +129,21 @@ class Module implements ConsoleBannerProviderInterface, ConsoleUsageProviderInte $this->getServiceManager()->get('Logger')->error($msg); } public function onDispatchError( $e ){ $userInfos = $this->getCurrentUserInfo(); $base = $userInfos['base']; if( $e->getParam('exception') instanceof \Exception ){ $msg = 'exception: ' . $e->getParam('exception')->getMessage(); } elseif ( is_string($e->getParam('exception'))) { $msg = 'error: ' . $e->getParam('exception'); } else { $msg = "Erreur non identifiée"; } $this->getLogger()->error("$base $msg"); } public function onUserLogin( $e ){ $dbUser = null; Loading Loading @@ -201,22 +215,18 @@ class Module implements ConsoleBannerProviderInterface, ConsoleUsageProviderInte $action = $match->getParam('action'); $uri = method_exists($request, 'getRequestUri') ? $request->getRequestUri() : 'console'; $ip = array_key_exists('REMOTE_ADDR', $_SERVER) ? $_SERVER['REMOTE_ADDR'] : '0.0.0.0'; $userInfos = $this->getCurrentUserInfo(); $base = $userInfos['base']; $method = $request->getMethod(); if( $userContext->getLdapUser() ){ $user = $userContext->getLdapUser()->getDisplayName(); } elseif ( $userContext->getDbUser() ){ $user = $userContext->getDbUser()->getDisplayName(); } else { $user = 'Anonymous'; } $userid = $userContext->getDbUser() ? $userContext->getDbUser()->getid() : -1; $contextId = $match->getParam('id', '?'); $message = sprintf('%s@%s:(%s) [%s] %s:%s %s', $ip, $userid, $user, $method, $controller, $action, $uri); $message = sprintf('%s [%s] %s:%s %s', $base, $method, $controller, $action, $uri); // $this->getLogger()->debug($message); } catch (\Exception $e) { error_log($e->getMessage()); Loading @@ -224,6 +234,40 @@ class Module implements ConsoleBannerProviderInterface, ConsoleUsageProviderInte } } protected function getCurrentUserInfo(){ static $userInfos; if( $userInfos === null ){ $ip = array_key_exists('REMOTE_ADDR', $_SERVER) ? $_SERVER['REMOTE_ADDR'] : '0.0.0.0'; $userContext = $this->getUserContext(); if( $this->getUserContext()->getLdapUser() ){ $auth = 'ldap'; $login = $userContext->getLdapUser()->getUsername(); $displayName = $userContext->getLdapUser()->getDisplayName(); } elseif ( $userContext->getDbUser() ){ $auth = 'bdd'; $login = $userContext->getDbUser()->getUsername(); $displayName = $userContext->getDbUser()->getDisplayName(); } else { $auth = "no"; $displayName = 'Anonymous'; $login = 'visitor'; } $userInfos = [ 'ip' => $ip, 'auth' => $auth, 'username' => $login, 'display' => $displayName, 'base' => sprintf('%s@%s (%s:%s)', $login, $ip, $auth, $displayName) ]; } return $userInfos; } public function getConfig() { return include __DIR__ . '/config/module.config.php'; Loading module/Oscar/src/Oscar/Service/PersonService.php +1 −2 Changes for module/Oscar/src/Oscar/Service/PersonService.php: 1 added line, 2 removed lines. Original line number Diff line number Diff line Loading @@ -461,8 +461,7 @@ die($privilege); } if( !isset($this->_cachePersonLdapLogin[$login]) ){ $this->getServiceLocator()->get('Logger')->info('Récupération de PERSON via ' . $login); // $this->getServiceLocator()->get('Logger')->info('Request BDD with ' . $login); $this->_cachePersonLdapLogin[$login] = $this->getBaseQuery() ->where('p.ladapLogin = :login') ->setParameter('login', $login) Loading Loading
composer.json +4 −1 Changes for composer.json: 4 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -33,7 +33,10 @@ "minimum-stability": "stable", "config": { "github-protocols": ["https", "ssh"], "secure-http": false "secure-http": false, "platform": { "php": "7.0" } }, "autoload": { "psr-0": { Loading
module/Oscar/Module.php +58 −14 Changes for module/Oscar/Module.php: 58 added lines, 14 removed lines. Original line number Diff line number Diff line Loading @@ -111,10 +111,9 @@ class Module implements ConsoleBannerProviderInterface, ConsoleUsageProviderInte // Envoi des erreurs dans les LOGS $e->getApplication()->getEventManager()->getSharedManager()->attach( '*', 'dispatch.error', function( $e ){ if( $e->getParam('exception') instanceof \Exception ) $e->getApplication()->getServiceManager()->get('Logger')->error($e->getParam('exception')->getMessage()); }); '*', 'dispatch.error', array($this, 'onDispatchError')); // Log des accès $e->getApplication()->getEventManager()->attach('*', function ($e) { Loading @@ -130,6 +129,21 @@ class Module implements ConsoleBannerProviderInterface, ConsoleUsageProviderInte $this->getServiceManager()->get('Logger')->error($msg); } public function onDispatchError( $e ){ $userInfos = $this->getCurrentUserInfo(); $base = $userInfos['base']; if( $e->getParam('exception') instanceof \Exception ){ $msg = 'exception: ' . $e->getParam('exception')->getMessage(); } elseif ( is_string($e->getParam('exception'))) { $msg = 'error: ' . $e->getParam('exception'); } else { $msg = "Erreur non identifiée"; } $this->getLogger()->error("$base $msg"); } public function onUserLogin( $e ){ $dbUser = null; Loading Loading @@ -201,22 +215,18 @@ class Module implements ConsoleBannerProviderInterface, ConsoleUsageProviderInte $action = $match->getParam('action'); $uri = method_exists($request, 'getRequestUri') ? $request->getRequestUri() : 'console'; $ip = array_key_exists('REMOTE_ADDR', $_SERVER) ? $_SERVER['REMOTE_ADDR'] : '0.0.0.0'; $userInfos = $this->getCurrentUserInfo(); $base = $userInfos['base']; $method = $request->getMethod(); if( $userContext->getLdapUser() ){ $user = $userContext->getLdapUser()->getDisplayName(); } elseif ( $userContext->getDbUser() ){ $user = $userContext->getDbUser()->getDisplayName(); } else { $user = 'Anonymous'; } $userid = $userContext->getDbUser() ? $userContext->getDbUser()->getid() : -1; $contextId = $match->getParam('id', '?'); $message = sprintf('%s@%s:(%s) [%s] %s:%s %s', $ip, $userid, $user, $method, $controller, $action, $uri); $message = sprintf('%s [%s] %s:%s %s', $base, $method, $controller, $action, $uri); // $this->getLogger()->debug($message); } catch (\Exception $e) { error_log($e->getMessage()); Loading @@ -224,6 +234,40 @@ class Module implements ConsoleBannerProviderInterface, ConsoleUsageProviderInte } } protected function getCurrentUserInfo(){ static $userInfos; if( $userInfos === null ){ $ip = array_key_exists('REMOTE_ADDR', $_SERVER) ? $_SERVER['REMOTE_ADDR'] : '0.0.0.0'; $userContext = $this->getUserContext(); if( $this->getUserContext()->getLdapUser() ){ $auth = 'ldap'; $login = $userContext->getLdapUser()->getUsername(); $displayName = $userContext->getLdapUser()->getDisplayName(); } elseif ( $userContext->getDbUser() ){ $auth = 'bdd'; $login = $userContext->getDbUser()->getUsername(); $displayName = $userContext->getDbUser()->getDisplayName(); } else { $auth = "no"; $displayName = 'Anonymous'; $login = 'visitor'; } $userInfos = [ 'ip' => $ip, 'auth' => $auth, 'username' => $login, 'display' => $displayName, 'base' => sprintf('%s@%s (%s:%s)', $login, $ip, $auth, $displayName) ]; } return $userInfos; } public function getConfig() { return include __DIR__ . '/config/module.config.php'; Loading
module/Oscar/src/Oscar/Service/PersonService.php +1 −2 Changes for module/Oscar/src/Oscar/Service/PersonService.php: 1 added line, 2 removed lines. Original line number Diff line number Diff line Loading @@ -461,8 +461,7 @@ die($privilege); } if( !isset($this->_cachePersonLdapLogin[$login]) ){ $this->getServiceLocator()->get('Logger')->info('Récupération de PERSON via ' . $login); // $this->getServiceLocator()->get('Logger')->info('Request BDD with ' . $login); $this->_cachePersonLdapLogin[$login] = $this->getBaseQuery() ->where('p.ladapLogin = :login') ->setParameter('login', $login) Loading