Loading config/autoload/unicaen-auth.global.php +1 −1 Changes for config/autoload/unicaen-auth.global.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ $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. */ 'save_ldap_user_in_database' => false, 'save_ldap_user_in_database' => true, 'enable_privileges' => true, Loading module/Application/Module.php +21 Changes for module/Application/Module.php: 21 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -33,8 +33,29 @@ class Module } } ); $e->getApplication()->getEventManager()->getSharedManager()->attach( "*", 'authenticate.success', array($this, 'onUserLogin'), 100 ); } public function onUserLogin( $e ) { if (is_string($identity = $e->getIdentity())) { // login de l'utilisateur authentifié $username = $identity; //... } else { // id de l'utilisateur authentifié dans la table $id = $identity; //... } //... } public function getConfig() { $configInit = [ Loading module/Application/src/Application/Controller/IndexController.php +26 Changes for module/Application/src/Application/Controller/IndexController.php: 26 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -9,27 +9,53 @@ namespace Application\Controller; use Application\Service\Agent\AgentServiceAwareTrait; use UnicaenAuth\Service\Traits\UserContextServiceAwareTrait; use Utilisateur\Entity\Db\Role; use Utilisateur\Service\Role\RoleServiceAwareTrait; use Utilisateur\Service\User\UserServiceAwareTrait; use Zend\Mvc\Controller\AbstractActionController; use Zend\View\Model\ViewModel; class IndexController extends AbstractActionController { use AgentServiceAwareTrait; use RoleServiceAwareTrait; use UserServiceAwareTrait; use UserContextServiceAwareTrait; public function indexAction() { /** @var Role $connectedRole */ $connectedRole = $this->getUserService()->getConnectedRole(); if ($connectedRole) { switch ($connectedRole->getRoleId()) { case Role::PERSONNEL : $this->redirect()->toRoute('index-personnel', [], [], true); break; default : var_dump($connectedRole); break; } } $identity = $this->getUserService()->getConnectedUser(); // !TODO bouger cela pour faire plus propre ... $agent = $this->getAgentService()->getAgentByUser($identity); if ($identity !== null && $agent === null) { $people = $this->getServiceUserContext()->getLdapUser(); if ($people->getSupannEmpId() !== null) { $personnel = $this->getRoleService()->getRoleByCode(Role::PERSONNEL); $this->getAgentService()->createFromLDAP($people, $identity); $this->getUserService()->addRole($identity, $personnel); $this->redirect()->toRoute('home', [], [], true); } } return new ViewModel([ 'user' => $identity, ]); Loading module/Application/src/Application/Controller/IndexControllerFactory.php +12 Changes for module/Application/src/Application/Controller/IndexControllerFactory.php: 12 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,9 @@ namespace Application\Controller; use Application\Service\Agent\AgentService; use UnicaenAuth\Service\UserContext; use Utilisateur\Service\Role\RoleService; use Utilisateur\Service\User\UserService; use Zend\Mvc\Controller\ControllerManager; Loading @@ -10,13 +13,22 @@ class IndexControllerFactory { public function __invoke(ControllerManager $controllerManager) { /** * @var AgentService $agentService * @var RoleService $roleService * @var UserService $userService * @var UserContext $userContext */ $agentService = $controllerManager->getServiceLocator()->get(AgentService::class); $roleService = $controllerManager->getServiceLocator()->get(RoleService::class); $userService = $controllerManager->getServiceLocator()->get(UserService::class); $userContext = $controllerManager->getServiceLocator()->get('UnicaenAuth\Service\UserContext'); /** @var IndexController $controller */ $controller = new IndexController(); $controller->setAgentService($agentService); $controller->setUserService($userService); $controller->setRoleService($roleService); $controller->setServiceUserContext($userContext); return $controller; } Loading module/Application/src/Application/Entity/Db/Agent.php +23 Changes for module/Application/src/Application/Entity/Db/Agent.php: 23 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ use DateTime; use Doctrine\Common\Collections\ArrayCollection; use Fichier\Entity\Db\Fichier; use UnicaenApp\Exception\RuntimeException; use Utilisateur\Entity\Db\User; class Agent { Loading Loading @@ -34,6 +35,8 @@ class Agent { private $corps; /** @var Grade */ private $grade; /** @var User */ private $utilisateur; /** @var string */ Loading Loading @@ -285,6 +288,26 @@ class Agent { return $this; } /** * @return User */ public function getUtilisateur() { return $this->utilisateur; } /** * @param User $utilisateur * @return Agent */ public function setUtilisateur($utilisateur) { $this->utilisateur = $utilisateur; return $this; } /** * @param string $natureCode * @return Fichier Loading Loading
config/autoload/unicaen-auth.global.php +1 −1 Changes for config/autoload/unicaen-auth.global.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ $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. */ 'save_ldap_user_in_database' => false, 'save_ldap_user_in_database' => true, 'enable_privileges' => true, Loading
module/Application/Module.php +21 Changes for module/Application/Module.php: 21 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -33,8 +33,29 @@ class Module } } ); $e->getApplication()->getEventManager()->getSharedManager()->attach( "*", 'authenticate.success', array($this, 'onUserLogin'), 100 ); } public function onUserLogin( $e ) { if (is_string($identity = $e->getIdentity())) { // login de l'utilisateur authentifié $username = $identity; //... } else { // id de l'utilisateur authentifié dans la table $id = $identity; //... } //... } public function getConfig() { $configInit = [ Loading
module/Application/src/Application/Controller/IndexController.php +26 Changes for module/Application/src/Application/Controller/IndexController.php: 26 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -9,27 +9,53 @@ namespace Application\Controller; use Application\Service\Agent\AgentServiceAwareTrait; use UnicaenAuth\Service\Traits\UserContextServiceAwareTrait; use Utilisateur\Entity\Db\Role; use Utilisateur\Service\Role\RoleServiceAwareTrait; use Utilisateur\Service\User\UserServiceAwareTrait; use Zend\Mvc\Controller\AbstractActionController; use Zend\View\Model\ViewModel; class IndexController extends AbstractActionController { use AgentServiceAwareTrait; use RoleServiceAwareTrait; use UserServiceAwareTrait; use UserContextServiceAwareTrait; public function indexAction() { /** @var Role $connectedRole */ $connectedRole = $this->getUserService()->getConnectedRole(); if ($connectedRole) { switch ($connectedRole->getRoleId()) { case Role::PERSONNEL : $this->redirect()->toRoute('index-personnel', [], [], true); break; default : var_dump($connectedRole); break; } } $identity = $this->getUserService()->getConnectedUser(); // !TODO bouger cela pour faire plus propre ... $agent = $this->getAgentService()->getAgentByUser($identity); if ($identity !== null && $agent === null) { $people = $this->getServiceUserContext()->getLdapUser(); if ($people->getSupannEmpId() !== null) { $personnel = $this->getRoleService()->getRoleByCode(Role::PERSONNEL); $this->getAgentService()->createFromLDAP($people, $identity); $this->getUserService()->addRole($identity, $personnel); $this->redirect()->toRoute('home', [], [], true); } } return new ViewModel([ 'user' => $identity, ]); Loading
module/Application/src/Application/Controller/IndexControllerFactory.php +12 Changes for module/Application/src/Application/Controller/IndexControllerFactory.php: 12 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,9 @@ namespace Application\Controller; use Application\Service\Agent\AgentService; use UnicaenAuth\Service\UserContext; use Utilisateur\Service\Role\RoleService; use Utilisateur\Service\User\UserService; use Zend\Mvc\Controller\ControllerManager; Loading @@ -10,13 +13,22 @@ class IndexControllerFactory { public function __invoke(ControllerManager $controllerManager) { /** * @var AgentService $agentService * @var RoleService $roleService * @var UserService $userService * @var UserContext $userContext */ $agentService = $controllerManager->getServiceLocator()->get(AgentService::class); $roleService = $controllerManager->getServiceLocator()->get(RoleService::class); $userService = $controllerManager->getServiceLocator()->get(UserService::class); $userContext = $controllerManager->getServiceLocator()->get('UnicaenAuth\Service\UserContext'); /** @var IndexController $controller */ $controller = new IndexController(); $controller->setAgentService($agentService); $controller->setUserService($userService); $controller->setRoleService($roleService); $controller->setServiceUserContext($userContext); return $controller; } Loading
module/Application/src/Application/Entity/Db/Agent.php +23 Changes for module/Application/src/Application/Entity/Db/Agent.php: 23 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ use DateTime; use Doctrine\Common\Collections\ArrayCollection; use Fichier\Entity\Db\Fichier; use UnicaenApp\Exception\RuntimeException; use Utilisateur\Entity\Db\User; class Agent { Loading Loading @@ -34,6 +35,8 @@ class Agent { private $corps; /** @var Grade */ private $grade; /** @var User */ private $utilisateur; /** @var string */ Loading Loading @@ -285,6 +288,26 @@ class Agent { return $this; } /** * @return User */ public function getUtilisateur() { return $this->utilisateur; } /** * @param User $utilisateur * @return Agent */ public function setUtilisateur($utilisateur) { $this->utilisateur = $utilisateur; return $this; } /** * @param string $natureCode * @return Fichier Loading