Loading config/merged/utilisateur.config.php +61 Changes for config/merged/utilisateur.config.php: 61 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -79,9 +79,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 @@ -171,6 +175,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 @@ -184,6 +203,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 @@ -197,6 +230,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 −1 Changes for config/module.config.php: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -4,7 +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\View\Helper\RoleViewHelper; 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 @@ -69,6 +70,7 @@ return [ 'invokables' => [], 'factories' => [ HistoriqueListener::class => HistoriqueListenerFactory::class, IdentityService::class => IdentityServiceFactory::class, ], ], Loading src/UnicaenUtilisateur/Controller/RoleController.php +15 −19 Changes for src/UnicaenUtilisateur/Controller/RoleController.php: 15 added lines, 19 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 Laminas\Mvc\Controller\AbstractActionController; use Laminas\Mvc\Plugin\FlashMessenger\FlashMessenger; Loading @@ -16,30 +18,24 @@ use Laminas\View\Model\ViewModel; /** @method FlashMessenger flashMessenger() */ class RoleController extends AbstractActionController { class RoleController extends AbstractActionController { use IdentityServiceAwareTrait; use RoleServiceAwareTrait; use RoleFormAwareTrait; /** * @var ProviderInterface */ private $identityProvider; public function setIdentityProvider($provider) { $this->identityProviders = $provider; } public function indexAction() : ViewModel { /** @var RoleInterface[] $roles */ $roles = $this->roleService->findAll(); $roleUsers = []; return new ViewModel([ '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() : CsvModel Loading Loading @@ -100,7 +96,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 @@ -129,7 +125,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 @@ -152,7 +148,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 @@ -6,6 +6,7 @@ use Interop\Container\ContainerInterface; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use UnicaenUtilisateur\Form\Role\RoleForm; use UnicaenUtilisateur\Provider\Identity\IdentityService; use UnicaenUtilisateur\Service\Role\RoleService; class RoleControllerFactory { Loading @@ -21,22 +22,15 @@ class RoleControllerFactory { public function __invoke(ContainerInterface $container, string $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-auth']['identity_providers'] !== "") { if (isset($config['unicaen-auth']['identity_providers'])) { $identityProviderPaths = $config['unicaen-auth']['identity_providers']; 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 +213 −140 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
config/merged/utilisateur.config.php +61 Changes for config/merged/utilisateur.config.php: 61 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -79,9 +79,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 @@ -171,6 +175,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 @@ -184,6 +203,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 @@ -197,6 +230,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 −1 Changes for config/module.config.php: 3 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -4,7 +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\View\Helper\RoleViewHelper; 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 @@ -69,6 +70,7 @@ return [ 'invokables' => [], 'factories' => [ HistoriqueListener::class => HistoriqueListenerFactory::class, IdentityService::class => IdentityServiceFactory::class, ], ], Loading
src/UnicaenUtilisateur/Controller/RoleController.php +15 −19 Changes for src/UnicaenUtilisateur/Controller/RoleController.php: 15 added lines, 19 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 Laminas\Mvc\Controller\AbstractActionController; use Laminas\Mvc\Plugin\FlashMessenger\FlashMessenger; Loading @@ -16,30 +18,24 @@ use Laminas\View\Model\ViewModel; /** @method FlashMessenger flashMessenger() */ class RoleController extends AbstractActionController { class RoleController extends AbstractActionController { use IdentityServiceAwareTrait; use RoleServiceAwareTrait; use RoleFormAwareTrait; /** * @var ProviderInterface */ private $identityProvider; public function setIdentityProvider($provider) { $this->identityProviders = $provider; } public function indexAction() : ViewModel { /** @var RoleInterface[] $roles */ $roles = $this->roleService->findAll(); $roleUsers = []; return new ViewModel([ '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() : CsvModel Loading Loading @@ -100,7 +96,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 @@ -129,7 +125,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 @@ -152,7 +148,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 @@ -6,6 +6,7 @@ use Interop\Container\ContainerInterface; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use UnicaenUtilisateur\Form\Role\RoleForm; use UnicaenUtilisateur\Provider\Identity\IdentityService; use UnicaenUtilisateur\Service\Role\RoleService; class RoleControllerFactory { Loading @@ -21,22 +22,15 @@ class RoleControllerFactory { public function __invoke(ContainerInterface $container, string $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-auth']['identity_providers'] !== "") { if (isset($config['unicaen-auth']['identity_providers'])) { $identityProviderPaths = $config['unicaen-auth']['identity_providers']; 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 +213 −140 File changed.Preview size limit exceeded, changes collapsed. Show changes