Loading src/UnicaenUtilisateur/Acl/NamedRole.php +14 −15 Original line number Diff line number Diff line <?php namespace UnicaenUtilisateur\Acl; use BjyAuthorize\Acl\Role; use Laminas\Permissions\Acl\Role\RoleInterface; /** * Rôle avec nom explicite (humainement intelligible). * * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr> */ class NamedRole extends \BjyAuthorize\Acl\Role class NamedRole extends Role { /** * @var string Loading @@ -31,11 +30,11 @@ class NamedRole extends \BjyAuthorize\Acl\Role * * @param string|null $id * @param RoleInterface|string|null $parent * @param string $name * @param string $description * @param string|null $name * @param string|null $description * @param bool $selectable */ public function __construct($id = null, $parent = null, $name = null, $description = null, $selectable = true) public function __construct($id = null, $parent = null, ?string $name = null, ?string $description = null, bool $selectable = true) { parent::__construct($id, $parent); Loading @@ -60,7 +59,7 @@ class NamedRole extends \BjyAuthorize\Acl\Role * * @return string */ public function getRoleName() public function getRoleName() : string { return $this->roleName; } Loading @@ -71,9 +70,9 @@ class NamedRole extends \BjyAuthorize\Acl\Role * @param string $roleName * @return self */ public function setRoleName($roleName) public function setRoleName(string $roleName) : NamedRole { $this->roleName = (string) $roleName; $this->roleName = $roleName; return $this; } Loading @@ -82,7 +81,7 @@ class NamedRole extends \BjyAuthorize\Acl\Role * * @return string */ public function getRoleDescription() public function getRoleDescription() : string { return $this->roleDescription; } Loading @@ -90,12 +89,12 @@ class NamedRole extends \BjyAuthorize\Acl\Role /** * Spécifie la description du rôle. * * @param string $roleDescription * @param string|null $roleDescription * @return self */ public function setRoleDescription($roleDescription) public function setRoleDescription(?string $roleDescription) : NamedRole { $this->roleDescription = (string) $roleDescription; $this->roleDescription = $roleDescription; return $this; } Loading @@ -106,7 +105,7 @@ class NamedRole extends \BjyAuthorize\Acl\Role * * @return bool */ public function getSelectable() public function getSelectable() : bool { return $this->selectable; } Loading @@ -119,7 +118,7 @@ class NamedRole extends \BjyAuthorize\Acl\Role * @param bool $selectable * @return NamedRole */ public function setSelectable($selectable = true) public function setSelectable(bool $selectable = true) : NamedRole { $this->selectable = $selectable; return $this; Loading src/UnicaenUtilisateur/Controller/RoleController.php +6 −7 Original line number Diff line number Diff line Loading @@ -10,7 +10,6 @@ use UnicaenUtilisateur\Entity\Db\RoleInterface; use UnicaenUtilisateur\Entity\Db\UserInterface; use UnicaenUtilisateur\Form\Role\RoleFormAwareTrait; use UnicaenUtilisateur\Service\Role\RoleServiceAwareTrait; use Laminas\Http\Request; use Laminas\Mvc\Controller\AbstractActionController; use Laminas\Mvc\Plugin\FlashMessenger\FlashMessenger; use Laminas\View\Model\ViewModel; Loading @@ -29,19 +28,18 @@ class RoleController extends AbstractActionController { $this->identityProviders = $provider; } public function indexAction() public function indexAction() : ViewModel { /** @var RoleInterface[] $roles */ $roles = $this->roleService->findAll(); return new ViewModel([ 'title' => "Gestion des rôles", 'roles' => $roles, 'identityproviders' => $this->identityProviders, ]); } public function exporterAction() public function exporterAction() : CsvModel { $role = $this->roleService->getRequestedRole($this); Loading Loading @@ -84,7 +82,7 @@ class RoleController extends AbstractActionController { return $CSV; } public function ajouterAction() public function ajouterAction() : ViewModel { $role = $this->roleService->getEntityInstance(); $form = $this->roleForm; Loading Loading @@ -113,7 +111,7 @@ class RoleController extends AbstractActionController { return $view; } public function modifierAction() public function modifierAction() : ViewModel { $role = $this->roleService->getRequestedRole($this); $form = $this->roleForm; Loading Loading @@ -142,8 +140,9 @@ class RoleController extends AbstractActionController { return $view; } public function supprimerAction() public function supprimerAction() : array { $role = null; try { $role = $this->roleService->getRequestedRole($this); $this->roleService->delete($role); Loading src/UnicaenUtilisateur/Controller/RoleControllerFactory.php +5 −3 Original line number Diff line number Diff line Loading @@ -3,20 +3,22 @@ namespace UnicaenUtilisateur\Controller; use Interop\Container\ContainerInterface; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use UnicaenUtilisateur\Form\Role\RoleForm; use UnicaenUtilisateur\Service\Role\RoleService; class RoleControllerFactory { /** * Create controller * * @param ContainerInterface $container * @param string $requestedName * @param array|null $options * @return RoleController|object * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function __invoke(ContainerInterface $container, $requestedName, array $options = null) public function __invoke(ContainerInterface $container, string $requestedName, array $options = null) { /** * @var RoleService $roleService Loading src/UnicaenUtilisateur/Controller/UtilisateurController.php +7 −11 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ namespace UnicaenUtilisateur\Controller; use BjyAuthorize\Provider\Identity\ProviderInterface; use DateTime; use Exception; use UnicaenApp\Service\EntityManagerAwareTrait; use UnicaenApp\View\Model\CsvModel; use UnicaenUtilisateur\Entity\Db\UserInterface; Loading @@ -13,7 +14,6 @@ use UnicaenUtilisateur\Service\RechercheIndividu\RechercheIndividuResultatInterf use UnicaenUtilisateur\Service\RechercheIndividu\RechercheIndividuServiceInterface; use UnicaenUtilisateur\Service\Role\RoleServiceAwareTrait; use UnicaenUtilisateur\Service\User\UserServiceAwareTrait; use Laminas\Http\Request; use Laminas\Mvc\Controller\AbstractActionController; use Laminas\Mvc\Plugin\FlashMessenger\FlashMessenger; use Laminas\View\Model\JsonModel; Loading Loading @@ -42,24 +42,18 @@ class UtilisateurController extends AbstractActionController /** * @param $searchServices * @return self */ public function setSearchServices($searchServices) public function setSearchServices($searchServices) : void { $this->searchServices = $searchServices; return $this; } /** * @param $provider * @return self */ public function setIdentityProvider($provider) public function setIdentityProvider($provider) : void { $this->identityProvider = $provider; return $this; } public function indexAction() Loading Loading @@ -196,6 +190,7 @@ class UtilisateurController extends AbstractActionController public function changerStatutAction() { $utilisateur = null; try { $utilisateur = $this->userService->getRequestedUser($this); $utilisateur = $this->userService->changeStatus($utilisateur); Loading @@ -214,6 +209,7 @@ class UtilisateurController extends AbstractActionController public function supprimerAction() { $utilisateur = null; try { $utilisateur = $this->userService->getRequestedUser($this); $this->userService->delete($utilisateur); Loading Loading @@ -269,7 +265,7 @@ class UtilisateurController extends AbstractActionController return new JsonModel($result); } public function listerAction() public function listerAction() : ViewModel { $users = $this->userService->findAll(); Loading @@ -279,7 +275,7 @@ class UtilisateurController extends AbstractActionController ]); } public function exporterAction() public function exporterAction() : CsvModel { $users = $this->userService->findAll(); $headers = [ 'Identifiant de connexion', 'Nom', 'Activé', 'Rôle']; Loading src/UnicaenUtilisateur/Controller/UtilisateurControllerFactory.php +5 −5 Original line number Diff line number Diff line Loading @@ -2,9 +2,9 @@ namespace UnicaenUtilisateur\Controller; use Application\Provider\IdentityProvider; use Doctrine\ORM\EntityManager; use Interop\Container\ContainerInterface; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use UnicaenUtilisateur\Form\User\UserForm; use UnicaenUtilisateur\Form\User\UserRechercheForm; use UnicaenUtilisateur\Service\RechercheIndividu\RechercheIndividuServiceInterface; Loading @@ -15,14 +15,14 @@ class UtilisateurControllerFactory { /** * Create controller * * @param ContainerInterface $container * @param string $requestedName * @param array|null $options * @return UtilisateurController|object * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function __invoke(ContainerInterface $container, $requestedName, array $options = null) public function __invoke(ContainerInterface $container, string $requestedName, array $options = null) { /** * @var RoleService $roleService Loading Loading
src/UnicaenUtilisateur/Acl/NamedRole.php +14 −15 Original line number Diff line number Diff line <?php namespace UnicaenUtilisateur\Acl; use BjyAuthorize\Acl\Role; use Laminas\Permissions\Acl\Role\RoleInterface; /** * Rôle avec nom explicite (humainement intelligible). * * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr> */ class NamedRole extends \BjyAuthorize\Acl\Role class NamedRole extends Role { /** * @var string Loading @@ -31,11 +30,11 @@ class NamedRole extends \BjyAuthorize\Acl\Role * * @param string|null $id * @param RoleInterface|string|null $parent * @param string $name * @param string $description * @param string|null $name * @param string|null $description * @param bool $selectable */ public function __construct($id = null, $parent = null, $name = null, $description = null, $selectable = true) public function __construct($id = null, $parent = null, ?string $name = null, ?string $description = null, bool $selectable = true) { parent::__construct($id, $parent); Loading @@ -60,7 +59,7 @@ class NamedRole extends \BjyAuthorize\Acl\Role * * @return string */ public function getRoleName() public function getRoleName() : string { return $this->roleName; } Loading @@ -71,9 +70,9 @@ class NamedRole extends \BjyAuthorize\Acl\Role * @param string $roleName * @return self */ public function setRoleName($roleName) public function setRoleName(string $roleName) : NamedRole { $this->roleName = (string) $roleName; $this->roleName = $roleName; return $this; } Loading @@ -82,7 +81,7 @@ class NamedRole extends \BjyAuthorize\Acl\Role * * @return string */ public function getRoleDescription() public function getRoleDescription() : string { return $this->roleDescription; } Loading @@ -90,12 +89,12 @@ class NamedRole extends \BjyAuthorize\Acl\Role /** * Spécifie la description du rôle. * * @param string $roleDescription * @param string|null $roleDescription * @return self */ public function setRoleDescription($roleDescription) public function setRoleDescription(?string $roleDescription) : NamedRole { $this->roleDescription = (string) $roleDescription; $this->roleDescription = $roleDescription; return $this; } Loading @@ -106,7 +105,7 @@ class NamedRole extends \BjyAuthorize\Acl\Role * * @return bool */ public function getSelectable() public function getSelectable() : bool { return $this->selectable; } Loading @@ -119,7 +118,7 @@ class NamedRole extends \BjyAuthorize\Acl\Role * @param bool $selectable * @return NamedRole */ public function setSelectable($selectable = true) public function setSelectable(bool $selectable = true) : NamedRole { $this->selectable = $selectable; return $this; Loading
src/UnicaenUtilisateur/Controller/RoleController.php +6 −7 Original line number Diff line number Diff line Loading @@ -10,7 +10,6 @@ use UnicaenUtilisateur\Entity\Db\RoleInterface; use UnicaenUtilisateur\Entity\Db\UserInterface; use UnicaenUtilisateur\Form\Role\RoleFormAwareTrait; use UnicaenUtilisateur\Service\Role\RoleServiceAwareTrait; use Laminas\Http\Request; use Laminas\Mvc\Controller\AbstractActionController; use Laminas\Mvc\Plugin\FlashMessenger\FlashMessenger; use Laminas\View\Model\ViewModel; Loading @@ -29,19 +28,18 @@ class RoleController extends AbstractActionController { $this->identityProviders = $provider; } public function indexAction() public function indexAction() : ViewModel { /** @var RoleInterface[] $roles */ $roles = $this->roleService->findAll(); return new ViewModel([ 'title' => "Gestion des rôles", 'roles' => $roles, 'identityproviders' => $this->identityProviders, ]); } public function exporterAction() public function exporterAction() : CsvModel { $role = $this->roleService->getRequestedRole($this); Loading Loading @@ -84,7 +82,7 @@ class RoleController extends AbstractActionController { return $CSV; } public function ajouterAction() public function ajouterAction() : ViewModel { $role = $this->roleService->getEntityInstance(); $form = $this->roleForm; Loading Loading @@ -113,7 +111,7 @@ class RoleController extends AbstractActionController { return $view; } public function modifierAction() public function modifierAction() : ViewModel { $role = $this->roleService->getRequestedRole($this); $form = $this->roleForm; Loading Loading @@ -142,8 +140,9 @@ class RoleController extends AbstractActionController { return $view; } public function supprimerAction() public function supprimerAction() : array { $role = null; try { $role = $this->roleService->getRequestedRole($this); $this->roleService->delete($role); Loading
src/UnicaenUtilisateur/Controller/RoleControllerFactory.php +5 −3 Original line number Diff line number Diff line Loading @@ -3,20 +3,22 @@ namespace UnicaenUtilisateur\Controller; use Interop\Container\ContainerInterface; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use UnicaenUtilisateur\Form\Role\RoleForm; use UnicaenUtilisateur\Service\Role\RoleService; class RoleControllerFactory { /** * Create controller * * @param ContainerInterface $container * @param string $requestedName * @param array|null $options * @return RoleController|object * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function __invoke(ContainerInterface $container, $requestedName, array $options = null) public function __invoke(ContainerInterface $container, string $requestedName, array $options = null) { /** * @var RoleService $roleService Loading
src/UnicaenUtilisateur/Controller/UtilisateurController.php +7 −11 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ namespace UnicaenUtilisateur\Controller; use BjyAuthorize\Provider\Identity\ProviderInterface; use DateTime; use Exception; use UnicaenApp\Service\EntityManagerAwareTrait; use UnicaenApp\View\Model\CsvModel; use UnicaenUtilisateur\Entity\Db\UserInterface; Loading @@ -13,7 +14,6 @@ use UnicaenUtilisateur\Service\RechercheIndividu\RechercheIndividuResultatInterf use UnicaenUtilisateur\Service\RechercheIndividu\RechercheIndividuServiceInterface; use UnicaenUtilisateur\Service\Role\RoleServiceAwareTrait; use UnicaenUtilisateur\Service\User\UserServiceAwareTrait; use Laminas\Http\Request; use Laminas\Mvc\Controller\AbstractActionController; use Laminas\Mvc\Plugin\FlashMessenger\FlashMessenger; use Laminas\View\Model\JsonModel; Loading Loading @@ -42,24 +42,18 @@ class UtilisateurController extends AbstractActionController /** * @param $searchServices * @return self */ public function setSearchServices($searchServices) public function setSearchServices($searchServices) : void { $this->searchServices = $searchServices; return $this; } /** * @param $provider * @return self */ public function setIdentityProvider($provider) public function setIdentityProvider($provider) : void { $this->identityProvider = $provider; return $this; } public function indexAction() Loading Loading @@ -196,6 +190,7 @@ class UtilisateurController extends AbstractActionController public function changerStatutAction() { $utilisateur = null; try { $utilisateur = $this->userService->getRequestedUser($this); $utilisateur = $this->userService->changeStatus($utilisateur); Loading @@ -214,6 +209,7 @@ class UtilisateurController extends AbstractActionController public function supprimerAction() { $utilisateur = null; try { $utilisateur = $this->userService->getRequestedUser($this); $this->userService->delete($utilisateur); Loading Loading @@ -269,7 +265,7 @@ class UtilisateurController extends AbstractActionController return new JsonModel($result); } public function listerAction() public function listerAction() : ViewModel { $users = $this->userService->findAll(); Loading @@ -279,7 +275,7 @@ class UtilisateurController extends AbstractActionController ]); } public function exporterAction() public function exporterAction() : CsvModel { $users = $this->userService->findAll(); $headers = [ 'Identifiant de connexion', 'Nom', 'Activé', 'Rôle']; Loading
src/UnicaenUtilisateur/Controller/UtilisateurControllerFactory.php +5 −5 Original line number Diff line number Diff line Loading @@ -2,9 +2,9 @@ namespace UnicaenUtilisateur\Controller; use Application\Provider\IdentityProvider; use Doctrine\ORM\EntityManager; use Interop\Container\ContainerInterface; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use UnicaenUtilisateur\Form\User\UserForm; use UnicaenUtilisateur\Form\User\UserRechercheForm; use UnicaenUtilisateur\Service\RechercheIndividu\RechercheIndividuServiceInterface; Loading @@ -15,14 +15,14 @@ class UtilisateurControllerFactory { /** * Create controller * * @param ContainerInterface $container * @param string $requestedName * @param array|null $options * @return UtilisateurController|object * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function __invoke(ContainerInterface $container, $requestedName, array $options = null) public function __invoke(ContainerInterface $container, string $requestedName, array $options = null) { /** * @var RoleService $roleService Loading