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.
This commit is contained in:
2026-07-01 12:35:52 -04:00
parent 080ba99b2f
commit 30c4103212
6 changed files with 77 additions and 5 deletions

View File

@ -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;

View File

@ -64,9 +64,6 @@ if (isset($_POST['btn_cancel_event_promo'])) {
<?php
fxShowBibTool4($strBibCode, $intEveId, $strLangue);
echo fxEveAccesPermInspectBadge('dossards.manage');
echo ' ';
echo fxEveAccesPermInspectBadge('epreuves.edit_qte');
?>
<link rel="stylesheet" href="<?php echo $vDomaine; ?>/libs/tippy.js-6.3.7/tippy.css">
<script src="<?php echo $vDomaine; ?>/libs/tippy.js-6.3.7/popper.min.js"></script>

View File

@ -247,6 +247,8 @@ if ($intEveId != 0) {
? 'Gestion des quantités et dossards'
: $strMenuGestionQteDossards;
?>
<?php echo fxEveAccesPermInspectBadge('dossards.manage', 'menu'); ?>
<?php echo fxEveAccesPermInspectBadge('epreuves.edit_qte', 'menu'); ?>
</a>
</li>
<?php
@ -267,6 +269,8 @@ if ($intEveId != 0) {
<a class="nav-list"
href="<?php echo $vDomaine; ?>/compte/inc_tableau_inscriptions_gestion?promoteur_eve_id=<?php echo urlencode(base64_encode($intEveId)); ?>&amp;lng=<?php echo $strLangue; ?>">
<i class="fa fa-users" aria-hidden="true"></i> <?php echo htmlspecialchars(fxInscrGestionPromoteurMenuLabel(), ENT_QUOTES, 'UTF-8'); ?>
<?php echo fxEveAccesPermInspectBadge('inscriptions_gestion.view', 'menu'); ?>
<?php echo fxEveAccesPermInspectBadge('registrations.view', 'menu'); ?>
</a>
</li>
<?php } ?>

View File

@ -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 '<span class="ms1-perm-inspect-slot">' . $strBadge . '</span>';
}
return $strHtml . ' ' . $strBadge;
}

View File

@ -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 '<span class="ms1-perm-inspect-slot">';
echo fxEveAccesPermInspectBadge($strPermKey, 'inscr_gestion');
echo ' <span class="text-muted small">' . fxInscrGestionEsc($strLabel) . '</span>';
echo '</span> ';
}
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 '<div class="inscr-gestion-gestion-actions">';
// 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')) . '</button>';
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')) . '</button>';
fxInscrGestionPermInspectEcho('inscriptions_gestion.refund');
} elseif ($blnInspect) {
fxInscrGestionPermInspectEchoHidden('inscriptions_gestion.refund', fxInscrGestionT('inscr_gestion_remboursement'));
}
if ($blnCanCancel) {
echo '<button class="btn btn-secondary btn-sm rounded-0 btn_cancel_event_promo' . $strStyleCancel . '" type="button"'
. ' id="annuler_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('btn_annulerinscriptions')) . '</button>';
fxInscrGestionPermInspectEcho('inscriptions_gestion.cancel');
} elseif ($blnInspect) {
fxInscrGestionPermInspectEchoHidden('inscriptions_gestion.cancel', fxInscrGestionT('btn_annulerinscriptions'));
}
if ($blnCanRestore) {
echo '<button class="btn btn-secondary btn-sm rounded-0 btn_retablir_event_promo' . $strStyleRetablir . '" type="button"'
. ' id="retablir_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('btn_retablirinscriptions')) . '</button>';
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 '<button class="btn btn-primary btn-sm rounded-0 link_confirmation" type="button"'
@ -1492,7 +1526,7 @@ function fxInscrGestionRenderFiche($intEveId, $strLangue, $strBaseUrl, $arrReq,
fxInscrGestionRenderFicheSectionEnd();
}
if ($blnHasEditable) {
if ($blnHasEditable || $blnInspect) {
fxInscrGestionRenderFicheSectionStart('editable', fxInscrGestionT('inscr_gestion_section_editable'), 'fa-pencil-square-o', true);
if ($blnCanBib) {
@ -1520,15 +1554,21 @@ function fxInscrGestionRenderFiche($intEveId, $strLangue, $strBaseUrl, $arrReq,
. ' data-epr_id="' . (int)$arrRow['epr_id'] . '"'
. ' data-par_id="' . (int)$intParId . '"'
. ' data-pec_id="' . (int)$arrRow['pec_id_original'] . '">OK</button>';
fxInscrGestionPermInspectEcho('inscriptions_gestion.bib_edit');
echo '</div>';
echo '</div>';
} elseif ($blnInspect) {
fxInscrGestionPermInspectEchoHidden('inscriptions_gestion.bib_edit', fxInscrGestionT('promoteur_bib_number'));
}
if ($blnCanStatut) {
echo '<div class="inscr-gestion-field-block inscr-gestion-field-block--statut" data-inscr-field="statut">';
echo '<div class="inscr-gestion-field-block__label">' . fxInscrGestionEsc(fxInscrGestionT('inscr_gestion_statut_label')) . '</div>';
fxInscrGestionRenderStatutField($intParId, $arrRow['par_statut_course'] ?? '', $arrRow['eve_id'], $strLangue);
fxInscrGestionPermInspectEcho('inscriptions_gestion.statut_edit');
echo '</div>';
} 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 '<span id="par_' . (int)$intParId . '">' . fxInscrGestionEsc($strRemisPar) . '</span>';
echo '</div></div></div>';
fxInscrGestionPermInspectEcho('inscriptions_gestion.bib_remis');
} elseif ($blnInspect) {
fxInscrGestionPermInspectEchoHidden('inscriptions_gestion.bib_remis', fxInscrGestionT('promoteur_bib_enregistre'));
}
fxInscrGestionRenderFicheSectionEnd();

View File

@ -3756,6 +3756,12 @@ function fxShowBibTool4($str_code, $int_eve_id, $strLangue){
<div class="card-header bib-tool-card-header">
<h2 class="bib-tool-card-title"><?php afficheTexte('promoteur_bib_tool')?></h2>
<?php
if (function_exists('fxEveAccesPermInspectBadge')) {
echo ' ' . fxEveAccesPermInspectBadge('dossards.manage', 'bib');
echo ' ' . fxEveAccesPermInspectBadge('epreuves.edit_qte', 'bib');
}
?>
</div>
<div id="module-bib" class="epr-wrapper" data-csrf-token="<?php echo fxBibEsc(fxBibCsrfToken()); ?>" data-lang="<?php echo fxBibEsc($strLangue); ?>" data-eve-id="<?php echo (int)$int_eve_id; ?>"<?php echo fxBibModuleJsDataAttrs(); ?><?php echo fxAdminTextEditModeActive() ? ' data-bib-trad="1"' : ''; ?>>