diff --git a/database/migration/1.0.4.sql b/database/migration/1.0.4.sql new file mode 100644 index 0000000000000000000000000000000000000000..6d43c8641a19446a61a65fc0f55af7ddd418b830 --- /dev/null +++ b/database/migration/1.0.4.sql @@ -0,0 +1,10 @@ +INSERT INTO unicaen_privilege_categorie (code, libelle, namespace, ordre) +VALUES ('agent', 'Gestion des agents', 'Agent\Provider\Privilege', 100); +INSERT INTO unicaen_privilege_privilege(CATEGORIE_ID, CODE, LIBELLE, ORDRE) +WITH d(code, lib, ordre) AS ( + SELECT 'agent_gerer_valideur_importe', 'Gérer les valideur·deuses importé·es', 60 UNION + SELECT 'agent_gerer_valideur_saisi', 'Gérer les valideur·deuses saisi·es', 70 +) +SELECT cp.id, d.code, d.lib, d.ordre +FROM d +JOIN unicaen_privilege_categorie cp ON cp.CODE = 'agent'; \ No newline at end of file diff --git a/database/script/init_privilege_1.sql b/database/script/init_privilege_1.sql index 38cf0790b9f81025b14f9dcac151548a1fa2fead..88adbcf23fa907523783a82b7f3e1398566fea7f 100644 --- a/database/script/init_privilege_1.sql +++ b/database/script/init_privilege_1.sql @@ -325,12 +325,14 @@ WITH d(code, lib, ordre) AS ( SELECT 'agent_index', 'Accéder à l''index', 0 UNION SELECT 'agent_afficher', 'Afficher un agent', 10 UNION SELECT 'agent_modifier', 'Modifier un agent', 30 UNION + SELECT 'agent_gerer_valideur_importe', 'Gérer les valideur·deuses importé·es', 60 UNION + SELECT 'agent_gerer_valideur_saisi', 'Gérer les valideur·deuses saisi·es', 70 UNION SELECT 'agent_rechercher', 'Rechercher un agent', 100 UNION SELECT 'agent_mesagents', 'Menu - Mes Agent·es -', 200 ) SELECT cp.id, d.code, d.lib, d.ordre FROM d - JOIN unicaen_privilege_categorie cp ON cp.CODE = 'agent'; +JOIN unicaen_privilege_categorie cp ON cp.CODE = 'agent'; -- STRUCTURE INSERT INTO unicaen_privilege_categorie (code, libelle, namespace, ordre) diff --git a/module/Agent/config/merged/agent-validateur.config.php b/module/Agent/config/merged/agent-validateur.config.php index 050fea43f48594273829c736c564b18b311ab3bc..86a366f78c056be2d5bac8ae55736d087c3b3d42 100644 --- a/module/Agent/config/merged/agent-validateur.config.php +++ b/module/Agent/config/merged/agent-validateur.config.php @@ -35,11 +35,19 @@ return [ 'ajouter', 'modifier', 'supprimer', + ], + 'privilege' => [ + AgentPrivileges::getResourceId(AgentPrivileges::AGENT_GERER_VALIDEUR_IMPORTE), + ], + ], + [ + 'controller' => ValidateurController::class, + 'action' => [ 'historiser', 'restaurer', ], 'privilege' => [ - AgentPrivileges::getResourceId(AgentPrivileges::AGENT_MODIFIER), + AgentPrivileges::getResourceId(AgentPrivileges::AGENT_GERER_VALIDEUR_SAISI), ], ], ], diff --git a/module/Agent/src/Provider/Privilege/AgentPrivileges.php b/module/Agent/src/Provider/Privilege/AgentPrivileges.php index 8901416fca449ea3326176be85edce48961d9184..b3a02c2cf63c0eaa3f76ea6e47265898ec60954a 100644 --- a/module/Agent/src/Provider/Privilege/AgentPrivileges.php +++ b/module/Agent/src/Provider/Privilege/AgentPrivileges.php @@ -11,4 +11,7 @@ class AgentPrivileges extends Privileges const AGENT_MODIFIER = 'agent-agent_modifier'; const AGENT_RECHERCHER = 'agent-agent_rechercher'; const AGENT_MESAGENTS = 'agent-agent_mesagents'; + + const AGENT_GERER_VALIDEUR_IMPORTE = 'agent-agent_gerer_valideur_importe'; + const AGENT_GERER_VALIDEUR_SAISI = 'agent-agent_gerer_valideur_saisi'; } \ No newline at end of file diff --git a/module/Agent/view/agent/agent/afficher.phtml b/module/Agent/view/agent/agent/afficher.phtml index 1480d87dfa75dc8ec2c0568d0300e24f24ff5fb0..975fbf6f1e2c0cc36459ec7891ee2f2bcfb3b25f 100644 --- a/module/Agent/view/agent/agent/afficher.phtml +++ b/module/Agent/view/agent/agent/afficher.phtml @@ -27,6 +27,8 @@ $this->headTitle("Afficher l'agent " . $agent->getDenomination()); $statuts = AgentStatut::generateStatutsArray($agentStatuts); +$canGererValideurSaisi = $this->isAllowed(AgentPrivileges::getResourceId(AgentPrivileges::AGENT_GERER_VALIDEUR_SAISI)); +$canGererValideurImporte = $this->isAllowed(AgentPrivileges::getResourceId(AgentPrivileges::AGENT_GERER_VALIDEUR_IMPORTE)); $canModifier = $this->isAllowed(AgentPrivileges::getResourceId(AgentPrivileges::AGENT_MODIFIER)); ?> @@ -118,7 +120,7 @@ $canModifier = $this->isAllowed(AgentPrivileges::getResourceId(AgentPrivileges:: <?php endif; ?> <dt class="col-md-4"> Validateur·trices<br> - <?php if ($canModifier) : ?> + <?php if ($canGererValideurSaisi) : ?> <?php /** @see \Agent\Controller\ValidateurController::ajouterAction() */ ?> <a href="<?php echo $this->url('agent/validateur/ajouter', ['agent' => $agent->getId()], [], true); ?>" class="btn btn-primary ajax-modal" data-event="modification"> @@ -137,13 +139,13 @@ $canModifier = $this->isAllowed(AgentPrivileges::getResourceId(AgentPrivileges:: <?php else: ?> <ul> <?php foreach ($validateurs as $validateur) : ?> - <?php if (!$validateur->estHistorise() or $canModifier) : ?> + <?php if (!$validateur->estHistorise() or $canGererValideurSaisi or $canGererValideurImporte) : ?> <li title="Sur la période du <?php echo $validateur->getDateDebut()->format('d/m/Y'); ?> au <?php echo $validateur->getDateFin() ? $validateur->getDateFin()->format('d/m/y') : " ---"; ?>"> <span class="<?php if ($validateur->estHistorise()) echo "historise"; ?>"><?php echo $validateur->getValidateur()->getDenomination(); ?></span> <span class="badge"> <?php echo $validateur->getSourceId(); ?> </span> - <?php if ($validateur->getSourceId() === 'MES FORMATIONS' and $canModifier) : ?> + <?php if ($validateur->getSourceId() === 'MES FORMATIONS' and $canGererValideurSaisi) : ?> <?php /** @see \Agent\Controller\ValidateurController::modifierAction() */ ?> <a href="<?php echo $this->url('agent/validateur/modifier', ['agent-validateur' => $validateur->getId()], [], true); ?>" class="ajax-modal action primary" data-event="modification"> @@ -157,19 +159,21 @@ $canModifier = $this->isAllowed(AgentPrivileges::getResourceId(AgentPrivileges:: Supprimer </a> <?php else : ?> - <?php if ($validateur->estHistorise()) : ?> - <?php /** @see \Agent\Controller\ValidateurController::restaurerAction() */ ?> - <a href="<?php echo $this->url('agent/validateur/restaurer', ['agent-validateur' => $validateur->getId()], [], true); ?>" - class="action warning" > - <span class="icon icon-restaurer"></span> - Ré-établir - </a> - <?php else : ?> - <a href="<?php echo $this->url('agent/validateur/historiser', ['agent-validateur' => $validateur->getId()], [], true); ?>" - class="action warning"> - <span class="icon icon-historiser"></span> - Révoquer - </a> + <?php if ($canGererValideurImporte AND $validateur->getSourceId() !== 'MES FORMATIONS') : ?> + <?php if ($validateur->estHistorise()) : ?> + <?php /** @see \Agent\Controller\ValidateurController::restaurerAction() */ ?> + <a href="<?php echo $this->url('agent/validateur/restaurer', ['agent-validateur' => $validateur->getId()], [], true); ?>" + class="action warning" > + <span class="icon icon-restaurer"></span> + Ré-établir + </a> + <?php else : ?> + <a href="<?php echo $this->url('agent/validateur/historiser', ['agent-validateur' => $validateur->getId()], [], true); ?>" + class="action warning"> + <span class="icon icon-historiser"></span> + Révoquer + </a> + <?php endif; ?> <?php endif; ?> <?php endif; ?> </li> diff --git a/module/Formation/src/Formation/View/Helper/partial/inscriptions.phtml b/module/Formation/src/Formation/View/Helper/partial/inscriptions.phtml index fdbf0691706010e47bdd0ee9bb1aca94417fb2e4..a682cd4a1868760ad272fe034417773dd0168686 100644 --- a/module/Formation/src/Formation/View/Helper/partial/inscriptions.phtml +++ b/module/Formation/src/Formation/View/Helper/partial/inscriptions.phtml @@ -89,8 +89,8 @@ if (!$displayDocument) $etatSize += 2; <?php if ($inscription->isRqth()) : ?> <br> <span class="text-info" data-bs-toggle="tooltip" data-bs-html="true" - title="<?php echo $inscription->getPrecisionRqth(); ?>"> - <span class="icon icon-rqth"></span> + title="<?php echo ($inscription->getPrecisionRqth())??"Aucune précision"; ?>"> + <span class="icon icon-rqth"></span> RQTH </span> <?php endif; ?>