Loading config/merged/utilisateur.config.php +61 −0 Changes for config/merged/utilisateur.config.php: 61 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -70,9 +70,13 @@ return [ [ 'controller' => UtilisateurController::class, 'action' => [ 'ajouter-perimetre', 'ajouter-role', 'lister-perimetre', 'lister-role', 'recharger-perimetre-role', 'recharger-role', 'supprimer-perimetre', 'supprimer-role', ], 'privileges' => [ Loading Loading @@ -162,6 +166,21 @@ return [ ], ], ], 'ajouter-perimetre' => [ 'type' => Segment::class, 'options' => [ 'route' => '/ajouter-perimetre/:utilisateur/:role/:perimetre', 'defaults' => [ 'controller' => UtilisateurController::class, 'action' => 'ajouter-perimetre', ], 'constraints' => [ 'utilisateur' => '\d+', 'role' => '\d+', 'perimetre' => '\d+', ], ], ], 'lister-role' => [ 'type' => Segment::class, 'options' => [ Loading @@ -175,6 +194,20 @@ return [ ], ], ], 'lister-perimetre' => [ 'type' => Segment::class, 'options' => [ 'route' => '/lister-perimetre/:utilisateur/:role', 'defaults' => [ 'controller' => UtilisateurController::class, 'action' => 'lister-perimetre', ], 'constraints' => [ 'utilisateur' => '\d+', 'role' => '\d+', ], ], ], 'recharger-role' => [ 'type' => Segment::class, 'options' => [ Loading @@ -188,6 +221,34 @@ return [ ], ], ], 'recharger-perimetre-role' => [ 'type' => Segment::class, 'options' => [ 'route' => '/recharger-perimetre-role/:utilisateur', 'defaults' => [ 'controller' => UtilisateurController::class, 'action' => 'recharger-perimetre-role', ], 'constraints' => [ 'utilisateur' => '\d+', ], ], ], 'supprimer-perimetre' => [ 'type' => Segment::class, 'options' => [ 'route' => '/supprimer-perimetre/:utilisateur/:role/:perimetre', 'defaults' => [ 'controller' => UtilisateurController::class, 'action' => 'supprimer-perimetre', ], 'constraints' => [ 'utilisateur' => '\d+', 'role' => '\d+', 'perimetre' => '\d+', ], ], ], 'supprimer-role' => [ 'type' => Segment::class, 'options' => [ Loading config/module.config.php +3 −0 Changes for config/module.config.php: 3 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -4,6 +4,8 @@ use Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain; use Doctrine\ORM\Mapping\Driver\XmlDriver; use UnicaenUtilisateur\ORM\Event\Listeners\HistoriqueListener; use UnicaenUtilisateur\ORM\Event\Listeners\HistoriqueListenerFactory; use UnicaenUtilisateur\Provider\Identity\IdentityService; use UnicaenUtilisateur\Provider\Identity\IdentityServiceFactory; use UnicaenUtilisateur\View\Helper\UserConnection; use UnicaenUtilisateur\View\Helper\UserConnectionFactory; use UnicaenUtilisateur\View\Helper\UserCurrent; Loading Loading @@ -68,6 +70,7 @@ return [ 'invokables' => [], 'factories' => [ HistoriqueListener::class => HistoriqueListenerFactory::class, IdentityService::class => IdentityServiceFactory::class, ], ], Loading src/UnicaenUtilisateur/Controller/RoleController.php +15 −17 Changes for src/UnicaenUtilisateur/Controller/RoleController.php: 15 added lines, 17 removed lines. Original line number Diff line number Diff line Loading @@ -8,7 +8,9 @@ use Exception; use UnicaenApp\View\Model\CsvModel; use UnicaenUtilisateur\Entity\Db\RoleInterface; use UnicaenUtilisateur\Entity\Db\UserInterface; use UnicaenUtilisateur\Exception\RuntimeException; use UnicaenUtilisateur\Form\Role\RoleFormAwareTrait; use UnicaenUtilisateur\Provider\Identity\IdentityServiceAwareTrait; use UnicaenUtilisateur\Service\Role\RoleServiceAwareTrait; use Zend\Http\Request; use Zend\Mvc\Controller\AbstractActionController; Loading @@ -17,28 +19,24 @@ use Zend\View\Model\ViewModel; /** @method FlashMessenger flashMessenger() */ class RoleController extends AbstractActionController { class RoleController extends AbstractActionController { use IdentityServiceAwareTrait; use RoleServiceAwareTrait; use RoleFormAwareTrait; /** @var ProviderInterface */ private $identityProviders; public function setIdentityProviders($provider) { $this->identityProviders = $provider; } public function indexAction() { /** @var RoleInterface[] $roles */ $roles = $this->roleService->findAll(); $roleUsers = []; return new ViewModel([ 'title' => "Gestion des rôles", 'roles' => $roles, 'identityproviders' => $this->identityProviders, ]); foreach($roles as $role) { $roleUsers[$role->getRoleId()] = $this->identityService->getRoleUsers($role); } $title = "Gestion des rôles"; return compact('title', 'roles', 'roleUsers'); } public function exporterAction() Loading Loading @@ -97,7 +95,7 @@ class RoleController extends AbstractActionController { try { $this->roleService->create($role); $this->flashMessenger()->addSuccessMessage(sprintf("Rôle <strong>%s</strong> créé avec succès.", $role->getLibelle())); } catch (Exception $e) { } catch (RuntimeException $e) { $this->flashMessenger()->addErrorMessage(sprintf("Une erreur est survenu lors de la création du rôle <strong>%s</strong>.", $role->getLibelle())); } } Loading Loading @@ -126,7 +124,7 @@ class RoleController extends AbstractActionController { try { $this->roleService->update($role); $this->flashMessenger()->addSuccessMessage(sprintf("Rôle <strong>%s</strong> modifié avec succès.", $role->getLibelle())); } catch (Exception $e) { } catch (RuntimeException $e) { $this->flashMessenger()->addErrorMessage(sprintf("Une erreur est survenu lors de la modification du rôle <strong>%s</strong>.", $role->getLibelle())); } } Loading @@ -148,7 +146,7 @@ class RoleController extends AbstractActionController { $role = $this->roleService->getRequestedRole($this); $this->roleService->delete($role); $this->flashMessenger()->addSuccessMessage(sprintf("Rôle <strong>%s</strong> supprimé avec succès.", $role->getLibelle())); } catch (Exception $e) { } catch (RuntimeException $e) { $this->flashMessenger()->addErrorMessage(sprintf("Une erreur est survenu lors de la suppression du rôle <strong>%s</strong>.", $role->getLibelle())); } Loading src/UnicaenUtilisateur/Controller/RoleControllerFactory.php +4 −10 Changes for src/UnicaenUtilisateur/Controller/RoleControllerFactory.php: 4 added lines, 10 removed lines. Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ namespace UnicaenUtilisateur\Controller; use Interop\Container\ContainerInterface; use UnicaenUtilisateur\Form\Role\RoleForm; use UnicaenUtilisateur\Provider\Identity\IdentityService; use UnicaenUtilisateur\Service\Role\RoleService; class RoleControllerFactory { Loading @@ -19,22 +20,15 @@ class RoleControllerFactory { public function __invoke(ContainerInterface $container, $requestedName, array $options = null) { /** * @var IdentityService $identityService * @var RoleService $roleService */ $identityService = $container->get(IdentityService::class); $roleService = $container->get(RoleService::class); $config = $container->get('Config'); $roleForm = $container->get('FormElementManager')->get(RoleForm::class); $identityProviders = []; if ($config['unicaen-utilisateur']['identity-provider'] !== "") { if (isset($config['unicaen-utilisateur']['identity-provider'])) { $identityProviderPaths = $config['unicaen-utilisateur']['identity-provider']; foreach ($identityProviderPaths as $identityProviderPath) $identityProviders[] = $container->get($identityProviderPath); } } $controller = new RoleController(); $controller->setIdentityProviders($identityProviders); $controller->setIdentityService($identityService); $controller->setRoleService($roleService); $controller->setRoleForm($roleForm); Loading src/UnicaenUtilisateur/Controller/UtilisateurController.php +207 −130 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
config/merged/utilisateur.config.php +61 −0 Changes for config/merged/utilisateur.config.php: 61 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -70,9 +70,13 @@ return [ [ 'controller' => UtilisateurController::class, 'action' => [ 'ajouter-perimetre', 'ajouter-role', 'lister-perimetre', 'lister-role', 'recharger-perimetre-role', 'recharger-role', 'supprimer-perimetre', 'supprimer-role', ], 'privileges' => [ Loading Loading @@ -162,6 +166,21 @@ return [ ], ], ], 'ajouter-perimetre' => [ 'type' => Segment::class, 'options' => [ 'route' => '/ajouter-perimetre/:utilisateur/:role/:perimetre', 'defaults' => [ 'controller' => UtilisateurController::class, 'action' => 'ajouter-perimetre', ], 'constraints' => [ 'utilisateur' => '\d+', 'role' => '\d+', 'perimetre' => '\d+', ], ], ], 'lister-role' => [ 'type' => Segment::class, 'options' => [ Loading @@ -175,6 +194,20 @@ return [ ], ], ], 'lister-perimetre' => [ 'type' => Segment::class, 'options' => [ 'route' => '/lister-perimetre/:utilisateur/:role', 'defaults' => [ 'controller' => UtilisateurController::class, 'action' => 'lister-perimetre', ], 'constraints' => [ 'utilisateur' => '\d+', 'role' => '\d+', ], ], ], 'recharger-role' => [ 'type' => Segment::class, 'options' => [ Loading @@ -188,6 +221,34 @@ return [ ], ], ], 'recharger-perimetre-role' => [ 'type' => Segment::class, 'options' => [ 'route' => '/recharger-perimetre-role/:utilisateur', 'defaults' => [ 'controller' => UtilisateurController::class, 'action' => 'recharger-perimetre-role', ], 'constraints' => [ 'utilisateur' => '\d+', ], ], ], 'supprimer-perimetre' => [ 'type' => Segment::class, 'options' => [ 'route' => '/supprimer-perimetre/:utilisateur/:role/:perimetre', 'defaults' => [ 'controller' => UtilisateurController::class, 'action' => 'supprimer-perimetre', ], 'constraints' => [ 'utilisateur' => '\d+', 'role' => '\d+', 'perimetre' => '\d+', ], ], ], 'supprimer-role' => [ 'type' => Segment::class, 'options' => [ Loading
config/module.config.php +3 −0 Changes for config/module.config.php: 3 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -4,6 +4,8 @@ use Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain; use Doctrine\ORM\Mapping\Driver\XmlDriver; use UnicaenUtilisateur\ORM\Event\Listeners\HistoriqueListener; use UnicaenUtilisateur\ORM\Event\Listeners\HistoriqueListenerFactory; use UnicaenUtilisateur\Provider\Identity\IdentityService; use UnicaenUtilisateur\Provider\Identity\IdentityServiceFactory; use UnicaenUtilisateur\View\Helper\UserConnection; use UnicaenUtilisateur\View\Helper\UserConnectionFactory; use UnicaenUtilisateur\View\Helper\UserCurrent; Loading Loading @@ -68,6 +70,7 @@ return [ 'invokables' => [], 'factories' => [ HistoriqueListener::class => HistoriqueListenerFactory::class, IdentityService::class => IdentityServiceFactory::class, ], ], Loading
src/UnicaenUtilisateur/Controller/RoleController.php +15 −17 Changes for src/UnicaenUtilisateur/Controller/RoleController.php: 15 added lines, 17 removed lines. Original line number Diff line number Diff line Loading @@ -8,7 +8,9 @@ use Exception; use UnicaenApp\View\Model\CsvModel; use UnicaenUtilisateur\Entity\Db\RoleInterface; use UnicaenUtilisateur\Entity\Db\UserInterface; use UnicaenUtilisateur\Exception\RuntimeException; use UnicaenUtilisateur\Form\Role\RoleFormAwareTrait; use UnicaenUtilisateur\Provider\Identity\IdentityServiceAwareTrait; use UnicaenUtilisateur\Service\Role\RoleServiceAwareTrait; use Zend\Http\Request; use Zend\Mvc\Controller\AbstractActionController; Loading @@ -17,28 +19,24 @@ use Zend\View\Model\ViewModel; /** @method FlashMessenger flashMessenger() */ class RoleController extends AbstractActionController { class RoleController extends AbstractActionController { use IdentityServiceAwareTrait; use RoleServiceAwareTrait; use RoleFormAwareTrait; /** @var ProviderInterface */ private $identityProviders; public function setIdentityProviders($provider) { $this->identityProviders = $provider; } public function indexAction() { /** @var RoleInterface[] $roles */ $roles = $this->roleService->findAll(); $roleUsers = []; return new ViewModel([ 'title' => "Gestion des rôles", 'roles' => $roles, 'identityproviders' => $this->identityProviders, ]); foreach($roles as $role) { $roleUsers[$role->getRoleId()] = $this->identityService->getRoleUsers($role); } $title = "Gestion des rôles"; return compact('title', 'roles', 'roleUsers'); } public function exporterAction() Loading Loading @@ -97,7 +95,7 @@ class RoleController extends AbstractActionController { try { $this->roleService->create($role); $this->flashMessenger()->addSuccessMessage(sprintf("Rôle <strong>%s</strong> créé avec succès.", $role->getLibelle())); } catch (Exception $e) { } catch (RuntimeException $e) { $this->flashMessenger()->addErrorMessage(sprintf("Une erreur est survenu lors de la création du rôle <strong>%s</strong>.", $role->getLibelle())); } } Loading Loading @@ -126,7 +124,7 @@ class RoleController extends AbstractActionController { try { $this->roleService->update($role); $this->flashMessenger()->addSuccessMessage(sprintf("Rôle <strong>%s</strong> modifié avec succès.", $role->getLibelle())); } catch (Exception $e) { } catch (RuntimeException $e) { $this->flashMessenger()->addErrorMessage(sprintf("Une erreur est survenu lors de la modification du rôle <strong>%s</strong>.", $role->getLibelle())); } } Loading @@ -148,7 +146,7 @@ class RoleController extends AbstractActionController { $role = $this->roleService->getRequestedRole($this); $this->roleService->delete($role); $this->flashMessenger()->addSuccessMessage(sprintf("Rôle <strong>%s</strong> supprimé avec succès.", $role->getLibelle())); } catch (Exception $e) { } catch (RuntimeException $e) { $this->flashMessenger()->addErrorMessage(sprintf("Une erreur est survenu lors de la suppression du rôle <strong>%s</strong>.", $role->getLibelle())); } Loading
src/UnicaenUtilisateur/Controller/RoleControllerFactory.php +4 −10 Changes for src/UnicaenUtilisateur/Controller/RoleControllerFactory.php: 4 added lines, 10 removed lines. Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ namespace UnicaenUtilisateur\Controller; use Interop\Container\ContainerInterface; use UnicaenUtilisateur\Form\Role\RoleForm; use UnicaenUtilisateur\Provider\Identity\IdentityService; use UnicaenUtilisateur\Service\Role\RoleService; class RoleControllerFactory { Loading @@ -19,22 +20,15 @@ class RoleControllerFactory { public function __invoke(ContainerInterface $container, $requestedName, array $options = null) { /** * @var IdentityService $identityService * @var RoleService $roleService */ $identityService = $container->get(IdentityService::class); $roleService = $container->get(RoleService::class); $config = $container->get('Config'); $roleForm = $container->get('FormElementManager')->get(RoleForm::class); $identityProviders = []; if ($config['unicaen-utilisateur']['identity-provider'] !== "") { if (isset($config['unicaen-utilisateur']['identity-provider'])) { $identityProviderPaths = $config['unicaen-utilisateur']['identity-provider']; foreach ($identityProviderPaths as $identityProviderPath) $identityProviders[] = $container->get($identityProviderPath); } } $controller = new RoleController(); $controller->setIdentityProviders($identityProviders); $controller->setIdentityService($identityService); $controller->setRoleService($roleService); $controller->setRoleForm($roleForm); Loading
src/UnicaenUtilisateur/Controller/UtilisateurController.php +207 −130 File changed.Preview size limit exceeded, changes collapsed. Show changes