Loading module/Application/config/others/admin.config.php +8 −11 Changes for module/Application/config/others/admin.config.php: 8 added lines, 11 removed lines. Original line number Diff line number Diff line <?php use Application\Controller\AdminController; use Application\Controller\Factory\RoleControllerFactory; use Application\Controller\Factory\PrivilegeControllerFactory; use Application\Controller\MailConfirmationController; use Application\Provider\Privilege\UtilisateurPrivileges; use UnicaenAuth\Guard\PrivilegeController; Loading @@ -26,7 +26,7 @@ return [ 'privileges' => UtilisateurPrivileges::UTILISATEUR_ATTRIBUTION_ROLE, ], [ 'controller' => 'Application\Controller\Role', 'controller' => \Application\Controller\PrivilegeController::class, 'action' => [ 'index', ], Loading @@ -36,7 +36,7 @@ return [ ], ], [ 'controller' => 'Application\Controller\Role', 'controller' => \Application\Controller\PrivilegeController::class, 'action' => [ 'modifier', ], Loading Loading @@ -86,13 +86,12 @@ return [ ], ], ], 'roles' => [ 'gestion-privilege' => [ 'type' => Literal::class, 'options' => [ 'route' => '/roles', 'route' => '/gestion-privilege', 'defaults' => [ '__NAMESPACE__' => 'Application\Controller', 'controller' => 'Role', 'controller' => \Application\Controller\PrivilegeController::class, 'action' => 'index', ], ], Loading Loading @@ -153,8 +152,7 @@ return [ 'options' => [ 'route' => '/modifier-privilege/:role/:privilege', 'defaults' => [ '__NAMESPACE__' => 'Application\Controller', 'controller' => 'Role', 'controller' => \Application\Controller\PrivilegeController::class, 'action' => 'modifier', ], ], Loading Loading @@ -208,9 +206,8 @@ return [ ], 'factories' => [ 'Application\Controller\Role' => RoleControllerFactory::class, \Application\Controller\PrivilegeController::class => \Application\Controller\Factory\PrivilegeControllerFactory::class, MailConfirmationController::class => MailConfirmationControllerFactory::class, ], ], Loading module/Application/config/others/droits.config.php +1 −1 Changes for module/Application/config/others/droits.config.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -90,7 +90,7 @@ return [ 'privileges' => [ 'label' => "Privilèges", 'title' => "Gestion des privilèges", 'route' => 'roles', 'route' => 'gestion-privilege', 'resource' => PrivilegeController::getResourceId('UnicaenAuth\Controller\Droits', 'privileges'), 'withtarget' => true, ], Loading module/Application/src/Application/Controller/Factory/RoleControllerFactory.php→module/Application/src/Application/Controller/Factory/PrivilegeControllerFactory.php +3 −3 Changes for module/Application/src/Application/Controller/Factory/PrivilegeControllerFactory.php: 3 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ namespace Application\Controller\Factory; use Application\Controller\RoleController; use Application\Controller\PrivilegeController; use Application\Service\Etablissement\EtablissementService; use Application\Service\Role\RoleService; use Application\Service\Structure\StructureService; Loading @@ -10,7 +10,7 @@ use Doctrine\ORM\EntityManager; use Zend\Mvc\Controller\ControllerManager; class RoleControllerFactory class PrivilegeControllerFactory { public function __invoke(ControllerManager $controllerManager) { Loading @@ -26,7 +26,7 @@ class RoleControllerFactory $etablissementService = $controllerManager->getServiceLocator()->get('EtablissementService'); $structureService = $controllerManager->getServiceLocator()->get('StructureService'); $controller = new RoleController(); $controller = new PrivilegeController(); $controller->setEntityManager($entityManager); $controller->setRoleService($roleService); $controller->setEtablissementService($etablissementService); Loading module/Application/src/Application/Controller/RoleController.php→module/Application/src/Application/Controller/PrivilegeController.php +1 −1 Changes for module/Application/src/Application/Controller/PrivilegeController.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -12,7 +12,7 @@ use UnicaenApp\Service\EntityManagerAwareTrait; use UnicaenAuth\Entity\Db\CategoriePrivilege; use Zend\View\Model\ViewModel; class RoleController extends AbstractController class PrivilegeController extends AbstractController { use EntityManagerAwareTrait; use RoleServiceAwareTrait; Loading module/Application/view/application/role/index.phtml→module/Application/view/application/privilege/index.phtml +63 −143 Changes for module/Application/view/application/privilege/index.phtml: 63 added lines, 143 removed lines. Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ */ ?> <?php $this->headTitle($this->translate("Rôles/Privilèges")) ?> <?php $this->headTitle("Rôles/Privilèges") ?> <h1 class="page-header first"> <?php echo $this->translate("Rôles/Privilèges") ?> </h1> Loading @@ -30,14 +30,71 @@ </div> </div> <table id='mytable' class='mytable table-bordered'> <thead> <tr> <th></th> <! -- //empty first cell --> <?php foreach ($roles as $role) : ?> <th class="role"> <?php $depend = ""; if ($role->isTheseDependant()) { $depend = "these"; } else { if ($role->getStructure() === null) { $sigleStructure = "structure manquante"; } else { $depend = $role->getStructure()->getTypeStructure()->getCode(); } } echo "<table id='mytable' class='mytable table-bordered'>"; echo generateTableHeader($roles); echo generateTableBody($roles,$privileges); echo "</table>"; $sigleStructure = ""; if ($role->getStructure() === null) { $sigleStructure = "structure manquante"; } elseif ($role->getStructure()->getSigle() === null || $role->getStructure()->getSigle() === "") { $sigleStructure = "sigle manquant"; } else { $sigleStructure = $role->getStructure()->getSigle(); } ?> <?php echo $role->getLibelle(); ?> <br/> <span class="depend <?php echo $depend; ?> "> <?php echo $sigleStructure; ?> </span> </th> <?php endforeach; ?> </tr> </thead> <tbody> <?php $previous_categorie = null; ?> <?php foreach($privileges as $privilege) : ?> <?php if ($previous_categorie !== $privilege->getCategorie()) : ?> <tr> <th colspan="<?php echo count($roles)+1; ?>" class="categorie"> <?php echo $privilege->getCategorie()->getLibelle(); ?> </th> </tr> <?php $previous_categorie = $privilege->getCategorie(); ?> <?php endif; ?> <tr> <th class="privilege"> <?php echo $privilege->getLibelle(); ?> </th> <?php foreach($roles as $role) : ?> <?php $code = ($role->getStructure() !== null) ? $role->getStructure()->getSigle() : ''; $title = $role->getLibelle(). ' - '.$code. " \n " .$privilege->getLibelle(); $id = $privilege->getId().'_'.$role->getId(); ?> <td class="droit" id="<?php echo $id; ?>" title="<?php echo $title;?>"> <?php if( array_search($role, $privilege->getRole()->toArray()) !== false) : ?> <span class="glyphicon glyphicon-ok text-success"></span> <?php else: ?> <span class="glyphicon glyphicon-remove text-danger"></span> <?php endif; ?> </td> <?php endforeach; ?> </tr> <?php endforeach; ?> </tbody> </table> <script> $(document).ready(function() { Loading Loading @@ -76,143 +133,6 @@ echo "</table>"; }); </script> <?php /** * Cette fonction génère le header du tableau des Rôles/Privilèges * @param Role[] $roles * @return string */ function generateTableHeader($roles) { $texte = ''; $texte .= '<thead>'; $texte .= '<tr>'; $texte .= '<th></th>'; //empty first cell foreach ($roles as $role) { $texte .= generateTableHeaderRole($role); } $texte .= '</tr>'; $texte .= '</thead>'; return $texte; } /** * Cette fonction est en charge de créer le header associé à un role avec sur : * - la première ligne : le libelle du rôle (Adminstrateur, Doctorant, ...) * - la seconde ligne : le sigle de la structure de rattachement (Unicaen, EA4285 CERMN, ...) * Attention elle aussi en charge de donner les bonnes classes CSS * @param Role $role * @return string */ function generateTableHeaderRole($role) { $libelleRole = $role->getLibelle(); //Les rôles "Adminstrateur technique" et "Observateur" non pas de structure associée !!! $sigleStructure = ""; $depend = ""; if ($role->isTheseDependant() || $role->isStructureDependant()) { // var_dump($role->getId(). " -> " .$role->getCode(). " --- ". $role->getRoleId()); $sigleStructure = ""; if ($role->getStructure() === null) { $sigleStructure = "structure manquante"; } elseif ($role->getStructure()->getSigle() === null || $role->getStructure()->getSigle() === "") { $sigleStructure = "sigle manquant"; } else { $sigleStructure = $role->getStructure()->getSigle(); } if ($role->isTheseDependant()) { $depend = "these"; } else { if ($role->getStructure() === null) { $sigleStructure = "structure manquante"; } else { $depend = $role->getStructure()->getTypeStructure()->getCode(); } } } $texte = '<th class="role">'; $texte .= $libelleRole; $texte .= '<br/>'; $texte .= '<span class="depend '.$depend.'">' .$sigleStructure . '</span>'; $texte .= '</th>'; return $texte; } /** * Cette fonction génère le body du tableau des Rôles/Privilèges * @param Role[] $roles * @param Privilege[] $privileges * @return string */ function generateTableBody($roles, $privileges) { $texte = ''; $texte .= '<tbody>'; $previous_categorie = null; foreach($privileges as $privilege) { if ($previous_categorie !== $privilege->getCategorie()) { $texte .= generateTableCategorieLine($privilege, $roles); $previous_categorie = $privilege->getCategorie(); } $texte .= generateTablePrivilegeLine($privilege, $roles); } $texte .= '</tbody>'; return $texte; } /** * Cette fonction génére la ligne traversant le tableau la de l'affichage d'un catégorie * @param Privilege $privilege * @param Role[] $roles * @return string */ function generateTableCategorieLine($privilege, $roles) { $texte = ''; $texte .= '<tr>'; $texte .= '<th colspan="'. (count($roles)+1) . '" class="categorie">'; $texte .= $privilege->getCategorie()->getLibelle(); $texte .= '</th>'; $texte .= '</tr>'; return $texte; } /** * * Cette fonction génére la ligne associée à un privilège * @param Privilege $privilege * @param Role[] $roles * @return string */ function generateTablePrivilegeLine($privilege, $roles) { $texte = ''; $texte .= '<tr>'; $texte .= '<th class="privilege">'.$privilege->getLibelle().'</th>'; foreach($roles as $role) { $code = ($role->getStructure() !== null) ? $role->getStructure()->getSigle() : ''; $title = $role->getLibelle(). ' - '.$code. " \n " .$privilege->getLibelle(); $id = $privilege->getId().'_'.$role->getId(); $texte .= '<td class="droit" id="'.$id.'" title="'.$title.'">'; if( array_search($role, $privilege->getRole()->toArray()) !== false) { $texte .= '<span class="glyphicon glyphicon-ok text-success"></span>'; } else { $texte .= '<span class="glyphicon glyphicon-remove text-danger"></span>'; } $texte .= '</td>'; } $texte.= '</tr>'; return $texte; } ?> <style> table.mytable { Loading Loading
module/Application/config/others/admin.config.php +8 −11 Changes for module/Application/config/others/admin.config.php: 8 added lines, 11 removed lines. Original line number Diff line number Diff line <?php use Application\Controller\AdminController; use Application\Controller\Factory\RoleControllerFactory; use Application\Controller\Factory\PrivilegeControllerFactory; use Application\Controller\MailConfirmationController; use Application\Provider\Privilege\UtilisateurPrivileges; use UnicaenAuth\Guard\PrivilegeController; Loading @@ -26,7 +26,7 @@ return [ 'privileges' => UtilisateurPrivileges::UTILISATEUR_ATTRIBUTION_ROLE, ], [ 'controller' => 'Application\Controller\Role', 'controller' => \Application\Controller\PrivilegeController::class, 'action' => [ 'index', ], Loading @@ -36,7 +36,7 @@ return [ ], ], [ 'controller' => 'Application\Controller\Role', 'controller' => \Application\Controller\PrivilegeController::class, 'action' => [ 'modifier', ], Loading Loading @@ -86,13 +86,12 @@ return [ ], ], ], 'roles' => [ 'gestion-privilege' => [ 'type' => Literal::class, 'options' => [ 'route' => '/roles', 'route' => '/gestion-privilege', 'defaults' => [ '__NAMESPACE__' => 'Application\Controller', 'controller' => 'Role', 'controller' => \Application\Controller\PrivilegeController::class, 'action' => 'index', ], ], Loading Loading @@ -153,8 +152,7 @@ return [ 'options' => [ 'route' => '/modifier-privilege/:role/:privilege', 'defaults' => [ '__NAMESPACE__' => 'Application\Controller', 'controller' => 'Role', 'controller' => \Application\Controller\PrivilegeController::class, 'action' => 'modifier', ], ], Loading Loading @@ -208,9 +206,8 @@ return [ ], 'factories' => [ 'Application\Controller\Role' => RoleControllerFactory::class, \Application\Controller\PrivilegeController::class => \Application\Controller\Factory\PrivilegeControllerFactory::class, MailConfirmationController::class => MailConfirmationControllerFactory::class, ], ], Loading
module/Application/config/others/droits.config.php +1 −1 Changes for module/Application/config/others/droits.config.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -90,7 +90,7 @@ return [ 'privileges' => [ 'label' => "Privilèges", 'title' => "Gestion des privilèges", 'route' => 'roles', 'route' => 'gestion-privilege', 'resource' => PrivilegeController::getResourceId('UnicaenAuth\Controller\Droits', 'privileges'), 'withtarget' => true, ], Loading
module/Application/src/Application/Controller/Factory/RoleControllerFactory.php→module/Application/src/Application/Controller/Factory/PrivilegeControllerFactory.php +3 −3 Changes for module/Application/src/Application/Controller/Factory/PrivilegeControllerFactory.php: 3 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ namespace Application\Controller\Factory; use Application\Controller\RoleController; use Application\Controller\PrivilegeController; use Application\Service\Etablissement\EtablissementService; use Application\Service\Role\RoleService; use Application\Service\Structure\StructureService; Loading @@ -10,7 +10,7 @@ use Doctrine\ORM\EntityManager; use Zend\Mvc\Controller\ControllerManager; class RoleControllerFactory class PrivilegeControllerFactory { public function __invoke(ControllerManager $controllerManager) { Loading @@ -26,7 +26,7 @@ class RoleControllerFactory $etablissementService = $controllerManager->getServiceLocator()->get('EtablissementService'); $structureService = $controllerManager->getServiceLocator()->get('StructureService'); $controller = new RoleController(); $controller = new PrivilegeController(); $controller->setEntityManager($entityManager); $controller->setRoleService($roleService); $controller->setEtablissementService($etablissementService); Loading
module/Application/src/Application/Controller/RoleController.php→module/Application/src/Application/Controller/PrivilegeController.php +1 −1 Changes for module/Application/src/Application/Controller/PrivilegeController.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -12,7 +12,7 @@ use UnicaenApp\Service\EntityManagerAwareTrait; use UnicaenAuth\Entity\Db\CategoriePrivilege; use Zend\View\Model\ViewModel; class RoleController extends AbstractController class PrivilegeController extends AbstractController { use EntityManagerAwareTrait; use RoleServiceAwareTrait; Loading
module/Application/view/application/role/index.phtml→module/Application/view/application/privilege/index.phtml +63 −143 Changes for module/Application/view/application/privilege/index.phtml: 63 added lines, 143 removed lines. Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ */ ?> <?php $this->headTitle($this->translate("Rôles/Privilèges")) ?> <?php $this->headTitle("Rôles/Privilèges") ?> <h1 class="page-header first"> <?php echo $this->translate("Rôles/Privilèges") ?> </h1> Loading @@ -30,14 +30,71 @@ </div> </div> <table id='mytable' class='mytable table-bordered'> <thead> <tr> <th></th> <! -- //empty first cell --> <?php foreach ($roles as $role) : ?> <th class="role"> <?php $depend = ""; if ($role->isTheseDependant()) { $depend = "these"; } else { if ($role->getStructure() === null) { $sigleStructure = "structure manquante"; } else { $depend = $role->getStructure()->getTypeStructure()->getCode(); } } echo "<table id='mytable' class='mytable table-bordered'>"; echo generateTableHeader($roles); echo generateTableBody($roles,$privileges); echo "</table>"; $sigleStructure = ""; if ($role->getStructure() === null) { $sigleStructure = "structure manquante"; } elseif ($role->getStructure()->getSigle() === null || $role->getStructure()->getSigle() === "") { $sigleStructure = "sigle manquant"; } else { $sigleStructure = $role->getStructure()->getSigle(); } ?> <?php echo $role->getLibelle(); ?> <br/> <span class="depend <?php echo $depend; ?> "> <?php echo $sigleStructure; ?> </span> </th> <?php endforeach; ?> </tr> </thead> <tbody> <?php $previous_categorie = null; ?> <?php foreach($privileges as $privilege) : ?> <?php if ($previous_categorie !== $privilege->getCategorie()) : ?> <tr> <th colspan="<?php echo count($roles)+1; ?>" class="categorie"> <?php echo $privilege->getCategorie()->getLibelle(); ?> </th> </tr> <?php $previous_categorie = $privilege->getCategorie(); ?> <?php endif; ?> <tr> <th class="privilege"> <?php echo $privilege->getLibelle(); ?> </th> <?php foreach($roles as $role) : ?> <?php $code = ($role->getStructure() !== null) ? $role->getStructure()->getSigle() : ''; $title = $role->getLibelle(). ' - '.$code. " \n " .$privilege->getLibelle(); $id = $privilege->getId().'_'.$role->getId(); ?> <td class="droit" id="<?php echo $id; ?>" title="<?php echo $title;?>"> <?php if( array_search($role, $privilege->getRole()->toArray()) !== false) : ?> <span class="glyphicon glyphicon-ok text-success"></span> <?php else: ?> <span class="glyphicon glyphicon-remove text-danger"></span> <?php endif; ?> </td> <?php endforeach; ?> </tr> <?php endforeach; ?> </tbody> </table> <script> $(document).ready(function() { Loading Loading @@ -76,143 +133,6 @@ echo "</table>"; }); </script> <?php /** * Cette fonction génère le header du tableau des Rôles/Privilèges * @param Role[] $roles * @return string */ function generateTableHeader($roles) { $texte = ''; $texte .= '<thead>'; $texte .= '<tr>'; $texte .= '<th></th>'; //empty first cell foreach ($roles as $role) { $texte .= generateTableHeaderRole($role); } $texte .= '</tr>'; $texte .= '</thead>'; return $texte; } /** * Cette fonction est en charge de créer le header associé à un role avec sur : * - la première ligne : le libelle du rôle (Adminstrateur, Doctorant, ...) * - la seconde ligne : le sigle de la structure de rattachement (Unicaen, EA4285 CERMN, ...) * Attention elle aussi en charge de donner les bonnes classes CSS * @param Role $role * @return string */ function generateTableHeaderRole($role) { $libelleRole = $role->getLibelle(); //Les rôles "Adminstrateur technique" et "Observateur" non pas de structure associée !!! $sigleStructure = ""; $depend = ""; if ($role->isTheseDependant() || $role->isStructureDependant()) { // var_dump($role->getId(). " -> " .$role->getCode(). " --- ". $role->getRoleId()); $sigleStructure = ""; if ($role->getStructure() === null) { $sigleStructure = "structure manquante"; } elseif ($role->getStructure()->getSigle() === null || $role->getStructure()->getSigle() === "") { $sigleStructure = "sigle manquant"; } else { $sigleStructure = $role->getStructure()->getSigle(); } if ($role->isTheseDependant()) { $depend = "these"; } else { if ($role->getStructure() === null) { $sigleStructure = "structure manquante"; } else { $depend = $role->getStructure()->getTypeStructure()->getCode(); } } } $texte = '<th class="role">'; $texte .= $libelleRole; $texte .= '<br/>'; $texte .= '<span class="depend '.$depend.'">' .$sigleStructure . '</span>'; $texte .= '</th>'; return $texte; } /** * Cette fonction génère le body du tableau des Rôles/Privilèges * @param Role[] $roles * @param Privilege[] $privileges * @return string */ function generateTableBody($roles, $privileges) { $texte = ''; $texte .= '<tbody>'; $previous_categorie = null; foreach($privileges as $privilege) { if ($previous_categorie !== $privilege->getCategorie()) { $texte .= generateTableCategorieLine($privilege, $roles); $previous_categorie = $privilege->getCategorie(); } $texte .= generateTablePrivilegeLine($privilege, $roles); } $texte .= '</tbody>'; return $texte; } /** * Cette fonction génére la ligne traversant le tableau la de l'affichage d'un catégorie * @param Privilege $privilege * @param Role[] $roles * @return string */ function generateTableCategorieLine($privilege, $roles) { $texte = ''; $texte .= '<tr>'; $texte .= '<th colspan="'. (count($roles)+1) . '" class="categorie">'; $texte .= $privilege->getCategorie()->getLibelle(); $texte .= '</th>'; $texte .= '</tr>'; return $texte; } /** * * Cette fonction génére la ligne associée à un privilège * @param Privilege $privilege * @param Role[] $roles * @return string */ function generateTablePrivilegeLine($privilege, $roles) { $texte = ''; $texte .= '<tr>'; $texte .= '<th class="privilege">'.$privilege->getLibelle().'</th>'; foreach($roles as $role) { $code = ($role->getStructure() !== null) ? $role->getStructure()->getSigle() : ''; $title = $role->getLibelle(). ' - '.$code. " \n " .$privilege->getLibelle(); $id = $privilege->getId().'_'.$role->getId(); $texte .= '<td class="droit" id="'.$id.'" title="'.$title.'">'; if( array_search($role, $privilege->getRole()->toArray()) !== false) { $texte .= '<span class="glyphicon glyphicon-ok text-success"></span>'; } else { $texte .= '<span class="glyphicon glyphicon-remove text-danger"></span>'; } $texte .= '</td>'; } $texte.= '</tr>'; return $texte; } ?> <style> table.mytable { Loading