From 30c410321259f605bf24dcffcb01ef1850a562e3 Mon Sep 17 00:00:00 2001 From: stephan Date: Wed, 1 Jul 2026 12:35:52 -0400 Subject: [PATCH] Enhance permission inspection features in admin interface This commit introduces new functions for displaying permission badges in various sections of the admin interface, improving visibility for super admins. It updates the sidebar and management sections to include these badges, ensuring that access rights are clearly indicated. Additionally, new CSS styles are added for better layout and alignment of the badges. The version code is updated to reflect these changes. --- css/style.css | 5 +++ inc_tableau_gestion_epreuves.php | 3 -- inc_tableau_promoteur.php | 4 +++ php/inc_fx_eve_acces.php | 17 +++++++++++ php/inc_fx_inscriptions_gestion.php | 47 +++++++++++++++++++++++++++-- php/inc_fx_promoteur.php | 6 ++++ 6 files changed, 77 insertions(+), 5 deletions(-) diff --git a/css/style.css b/css/style.css index 08593f3..eaffd98 100644 --- a/css/style.css +++ b/css/style.css @@ -1068,6 +1068,11 @@ ul.ms1-menu-compte li a:hover, ul.ms1-menu-compte li a:active { outline:2px dashed rgba(224,168,0,.55); outline-offset:4px; } +.ms1-perm-inspect-slot{ + display:inline-block; + margin:2px 6px 2px 0; + vertical-align:middle; +} .epr-wrapper{ display:flex; diff --git a/inc_tableau_gestion_epreuves.php b/inc_tableau_gestion_epreuves.php index 171ad95..935f2d7 100644 --- a/inc_tableau_gestion_epreuves.php +++ b/inc_tableau_gestion_epreuves.php @@ -64,9 +64,6 @@ if (isset($_POST['btn_cancel_event_promo'])) { diff --git a/inc_tableau_promoteur.php b/inc_tableau_promoteur.php index a88228e..0ed72ec 100644 --- a/inc_tableau_promoteur.php +++ b/inc_tableau_promoteur.php @@ -247,6 +247,8 @@ if ($intEveId != 0) { ? 'Gestion des quantités et dossards' : $strMenuGestionQteDossards; ?> + + /compte/inc_tableau_inscriptions_gestion?promoteur_eve_id=&lng="> + + diff --git a/php/inc_fx_eve_acces.php b/php/inc_fx_eve_acces.php index 681200b..50afdab 100644 --- a/php/inc_fx_eve_acces.php +++ b/php/inc_fx_eve_acces.php @@ -1796,3 +1796,20 @@ function fxEveAccesPermInspectZoneAttr($strPermKey) return ' class="ms1-perm-inspect-zone" data-ms1-perm="' . htmlspecialchars($strPermKey, ENT_QUOTES, 'UTF-8') . '"'; } + +/** + * En mode inspecteur : badge apres un controle visible, ou seul si le controle est masque. + */ +function fxEveAccesPermInspectMark($strPermKey, $strHtml = '', $strContext = 'v2') +{ + if (!function_exists('fxAdminPermInspectModeActive') || !fxAdminPermInspectModeActive()) { + return $strHtml; + } + + $strBadge = fxEveAccesPermInspectBadge($strPermKey, $strContext); + if ($strHtml === '') { + return '' . $strBadge . ''; + } + + return $strHtml . ' ' . $strBadge; +} diff --git a/php/inc_fx_inscriptions_gestion.php b/php/inc_fx_inscriptions_gestion.php index 7d89373..89820a7 100644 --- a/php/inc_fx_inscriptions_gestion.php +++ b/php/inc_fx_inscriptions_gestion.php @@ -63,6 +63,27 @@ function fxInscrGestionCanDo($intComId, $intEveId, $strActionPerm) { return false; } +/** Badge cadenas (mode inspecteur super admin) sur la fiche de gestion. */ +function fxInscrGestionPermInspectEcho($strPermKey) { + if (!function_exists('fxAdminPermInspectModeActive') || !fxAdminPermInspectModeActive()) { + return; + } + fxInscrGestionLoadEveAcces(); + echo ' ' . fxEveAccesPermInspectBadge($strPermKey, 'inscr_gestion'); +} + +/** Badge + libelle pour un controle masque par les droits (mode inspecteur). */ +function fxInscrGestionPermInspectEchoHidden($strPermKey, $strLabel) { + if (!function_exists('fxAdminPermInspectModeActive') || !fxAdminPermInspectModeActive()) { + return; + } + fxInscrGestionLoadEveAcces(); + echo ''; + echo fxEveAccesPermInspectBadge($strPermKey, 'inscr_gestion'); + echo ' ' . fxInscrGestionEsc($strLabel) . ''; + echo ' '; +} + function fxInscrGestionLoadEveAcces() { require_once __DIR__ . '/inc_fx_eve_acces.php'; } @@ -1365,6 +1386,7 @@ function fxInscrGestionRenderFiche($intEveId, $strLangue, $strBaseUrl, $arrReq, $blnCanRefund = fxInscrGestionCanDo($intComId, $intRowEveId, 'inscriptions_gestion.refund'); $blnHasEditable = ($blnCanStatut || $blnCanBib || $blnCanRemis); $blnHasGestion = ($blnCanEdit || $blnCanCancel || $blnCanRestore || $blnCanRefund); + $blnInspect = function_exists('fxAdminPermInspectModeActive') && fxAdminPermInspectModeActive(); $strListUrl = fxInscrGestionBuildUrl($strBaseUrl, $intEveId, $arrReq, array('pec_id' => null, 'pg' => $arrReq['pg'])); $strEveCode = fxGetEvenementsUrl($arrRow['eve_id']); @@ -1429,7 +1451,7 @@ function fxInscrGestionRenderFiche($intEveId, $strLangue, $strBaseUrl, $arrReq, // Libelle du bouton de renvoi (facture/invitation) : passe par la table info pour etre editable. $strRenvoi = fxInscrGestionT('inscr_gestion_renvoi'); - if ($blnHasGestion) { + if ($blnHasGestion || $blnInspect) { fxInscrGestionRenderFicheSectionStart('gestion', fxInscrGestionT('inscr_gestion_section_management'), 'fa-cog', !$blnFromQr); echo '
'; // Libelle devant le bouton facture (numero de commande) — invite a afficher la facture. @@ -1448,6 +1470,9 @@ function fxInscrGestionRenderFiche($intEveId, $strLangue, $strBaseUrl, $arrReq, . ' id="modifier_fiche" data-eve_code="' . fxInscrGestionEsc($strEveCode) . '"' . ' data-epr_id="' . (int)$arrRow['epr_id'] . '" data-eve_id="' . (int)$arrRow['eve_id'] . '"' . ' value="' . (int)$arrRow['pec_id_original'] . '">' . fxInscrGestionEsc(fxInscrGestionT('inscr_gestion_modifier_participant')) . ''; + fxInscrGestionPermInspectEcho('inscriptions_gestion.edit'); + } elseif ($blnInspect) { + fxInscrGestionPermInspectEchoHidden('inscriptions_gestion.edit', fxInscrGestionT('inscr_gestion_modifier_participant')); } if ($blnCanRefund) { // Bouton bascule : ouvre/ferme le panneau de remboursement et declenche le chargement AJAX du formulaire. @@ -1457,18 +1482,27 @@ function fxInscrGestionRenderFiche($intEveId, $strLangue, $strBaseUrl, $arrReq, . ' data-eve_id="' . (int)$intRowEveId . '"' . ' data-refund-target="#inscr-gestion-refund-panel"' . ' aria-expanded="false">' . fxInscrGestionEsc(fxInscrGestionT('inscr_gestion_remboursement')) . ''; + fxInscrGestionPermInspectEcho('inscriptions_gestion.refund'); + } elseif ($blnInspect) { + fxInscrGestionPermInspectEchoHidden('inscriptions_gestion.refund', fxInscrGestionT('inscr_gestion_remboursement')); } if ($blnCanCancel) { echo ''; + fxInscrGestionPermInspectEcho('inscriptions_gestion.cancel'); + } elseif ($blnInspect) { + fxInscrGestionPermInspectEchoHidden('inscriptions_gestion.cancel', fxInscrGestionT('btn_annulerinscriptions')); } if ($blnCanRestore) { echo ''; + fxInscrGestionPermInspectEcho('inscriptions_gestion.restore'); + } elseif ($blnInspect) { + fxInscrGestionPermInspectEchoHidden('inscriptions_gestion.restore', fxInscrGestionT('btn_retablirinscriptions')); } // RENVOI place en dernier (MSIN-4403) : retourne la confirmation au participant. echo ''; + fxInscrGestionPermInspectEcho('inscriptions_gestion.bib_edit'); echo '
'; echo ''; + } elseif ($blnInspect) { + fxInscrGestionPermInspectEchoHidden('inscriptions_gestion.bib_edit', fxInscrGestionT('promoteur_bib_number')); } if ($blnCanStatut) { echo '
'; echo '
' . fxInscrGestionEsc(fxInscrGestionT('inscr_gestion_statut_label')) . '
'; fxInscrGestionRenderStatutField($intParId, $arrRow['par_statut_course'] ?? '', $arrRow['eve_id'], $strLangue); + fxInscrGestionPermInspectEcho('inscriptions_gestion.statut_edit'); echo '
'; + } elseif ($blnInspect) { + fxInscrGestionPermInspectEchoHidden('inscriptions_gestion.statut_edit', fxInscrGestionT('inscr_gestion_statut_label')); } $strRemisDate = trim((string)$arrRow['no_bib_remis_date']); @@ -1556,6 +1596,9 @@ function fxInscrGestionRenderFiche($intEveId, $strLangue, $strBaseUrl, $arrReq, } echo '' . fxInscrGestionEsc($strRemisPar) . ''; echo ''; + fxInscrGestionPermInspectEcho('inscriptions_gestion.bib_remis'); + } elseif ($blnInspect) { + fxInscrGestionPermInspectEchoHidden('inscriptions_gestion.bib_remis', fxInscrGestionT('promoteur_bib_enregistre')); } fxInscrGestionRenderFicheSectionEnd(); diff --git a/php/inc_fx_promoteur.php b/php/inc_fx_promoteur.php index a6512ab..f8110c1 100644 --- a/php/inc_fx_promoteur.php +++ b/php/inc_fx_promoteur.php @@ -3756,6 +3756,12 @@ function fxShowBibTool4($str_code, $int_eve_id, $strLangue){

+
>