Enhance event access control and integrate new permission checks

This commit introduces the `fxEveAccesCanManageBibV4` and `fxEveAccesCanQrTest` functions to improve event access management. It updates various files to utilize these new permission checks, ensuring that only authorized users can manage event registrations and access QR testing features. Additionally, redundant session checks are removed, and redirection logic is refined for better user experience across the application.
This commit is contained in:
2026-06-19 12:49:19 -04:00
parent d5fdb227dd
commit e9ad3d8a92
7 changed files with 188 additions and 22 deletions

View File

@ -1,22 +1,14 @@
<?php
// MSIN-4379 — Gestion quantités + dossards v4 (rollout superadm, fxShowBibTool4 seulement)
// MSIN-4379 — Gestion quantités + dossards v4 (droits v2 ou super admin)
include_once("php/inc_fx_modifierinscriptions.php");
include_once("php/inc_fx_memberships.php");
include_once("php/inc_fx_promoteur.php");
require_once('php/inc_fx_eve_acces.php');
require_once('superadm/php/inc_manager.php');
global $objDatabase, $vDomaine, $strLangue;
if (!isset($_SESSION['usa_id'])) {
$strRedirect = $vDomaine . '/compte/inc_tableau_promoteur';
if (!empty($_GET['promoteur_eve_id'])) {
$strRedirect .= '?promoteur_eve_id=' . urlencode($_GET['promoteur_eve_id']);
}
header('Location: ' . $strRedirect);
exit;
}
$intEveId = 0;
if ($strLangue == 'fr') {
@ -36,6 +28,15 @@ if (isset($_GET['promoteur_eve_id'])) {
$intEveId = base64_decode(urldecode($_GET['promoteur_eve_id']));
}
if ($intEveId <= 0 || (empty($_SESSION['com_id']) && empty($_SESSION['usa_id'])) || !fxEveAccesCanManageBibV4($_SESSION['com_id'] ?? 0, $intEveId)) {
$strRedirect = $vDomaine . '/compte/inc_tableau_promoteur';
if (!empty($_GET['promoteur_eve_id'])) {
$strRedirect .= '?promoteur_eve_id=' . urlencode($_GET['promoteur_eve_id']);
}
header('Location: ' . $strRedirect);
exit;
}
$strBackUrl = fxGetPromoteurBackUrl($intEveId, $strPage);
?>
<a class="btn btn-primary rounded-pill" id="link_back" href="<?php echo $strBackUrl; ?>">
@ -56,8 +57,7 @@ if (isset($_POST['btn_cancel_event_promo'])) {
fxAnnulerRetablirInscription($tabEpreuve, $int_pec_id);
}
if ($intEveId != 0) {
?>
?>
<?php
@ -72,10 +72,3 @@ if ($intEveId != 0) {
<?php afficheTexte('promoteur_back'); ?>
</a>
<?php
} else {
if ($strLangue == 'fr') {
echo "Une erreur quelconque est survenue.";
} else {
echo "A generic error occurred.";
}
}