restructurer les acces

This commit is contained in:
2026-06-23 14:19:57 -04:00
parent bc8bc86b74
commit 2cf8f5e7ec
5 changed files with 11 additions and 40 deletions

View File

@ -316,7 +316,8 @@ if (isset($_GET['promoteur_eve_id'])) {
exit;
}
} elseif ($strCode === 'compte_inc_tableau_gestion_epreuves') {
if (!fxEveAccesCanManageBibV4($_SESSION['com_id'] ?? 0, $intEveIdbase)) {
if (empty($_SESSION['usa_id'])
&& !fxEveAccesHasAnyPermission($_SESSION['com_id'] ?? 0, $intEveIdbase, array('dossards.manage', 'epreuves.edit_qte'))) {
header('Location: ' . $vDomaine . '/' . $strPage);
exit;
}

View File

@ -29,7 +29,8 @@ if (isset($_GET['promoteur_eve_id'])) {
}
if ($intEveId <= 0 || (empty($_SESSION['com_id']) && empty($_SESSION['usa_id']))
|| !fxEveAccesCanManageBibV4($_SESSION['com_id'] ?? 0, $intEveId)) {
|| (empty($_SESSION['usa_id'])
&& !fxEveAccesHasAnyPermission($_SESSION['com_id'] ?? 0, $intEveId, array('dossards.manage', 'epreuves.edit_qte')))) {
$strRedirect = $vDomaine . '/compte/inc_tableau_promoteur';
if (!empty($_GET['promoteur_eve_id'])) {
$strRedirect .= '?promoteur_eve_id=' . urlencode($_GET['promoteur_eve_id']);

View File

@ -234,7 +234,9 @@ if ($intEveId != 0) {
</li><?php
}
?>
if (!empty($_SESSION['usa_id'])
|| fxEveAccesHasAnyPermission($_SESSION['com_id'] ?? 0, $intEveId, array('dossards.manage', 'epreuves.edit_qte'))) {
?>
<li class="nav-item">
<a class="nav-list"
href="<?php echo $vDomaine; ?>/compte/inc_tableau_gestion_epreuves?promoteur_eve_id=<?php echo urlencode(base64_encode($intEveId)); ?> &lng=<?php echo $strLangue; ?>">
@ -247,7 +249,8 @@ if ($intEveId != 0) {
?>
</a>
</li>
<?php
<?php
}
}

View File

@ -236,41 +236,6 @@ function fxEveAccesGetEventIdsWithAnyPermission($intComId, $arrPermKeys)
return $arrIds;
}
function fxEveAccesIsSuperAdminSession()
{
return !empty($_SESSION['usa_id']);
}
/** Permissions gestion bib v4 (quantites + dossards). */
function fxEveAccesBibV4PermKeys()
{
return array('dossards.manage', 'epreuves.edit_qte');
}
/** Gate unique bib v4 — menu, page, AJAX. Pilote : promoteur legacy OU droits v2. */
function fxEveAccesCanManageBibV4($intComId, $intEveId)
{
if (fxEveAccesIsSuperAdminSession()) {
return true;
}
$intComId = intval($intComId);
$intEveId = intval($intEveId);
if ($intComId <= 0 || $intEveId <= 0) {
return false;
}
// Pilote prod : promoteur legacy (com_eve_promoteur) = acces bib v4 comme avant v2.
if (!function_exists('fxIsPromoteur')) {
require_once __DIR__ . '/inc_fonctions.php';
}
if (fxIsPromoteur($intComId, $intEveId)) {
return true;
}
return fxEveAccesHasAnyPermission($intComId, $intEveId, fxEveAccesBibV4PermKeys());
}
/** Outil debug QR — permission v2 tools.qr_test uniquement (pas de bypass super admin). */
function fxEveAccesCanQrTest($intComId)
{

View File

@ -2765,7 +2765,8 @@ function fxBibRequireAjaxAccess() {
$intComId = intval($_SESSION['com_id'] ?? 0);
$intEveId = fxBibResolveEveIdFromRequest();
if ($intComId <= 0 || $intEveId <= 0 || !fxEveAccesCanManageBibV4($intComId, $intEveId)) {
if ($intComId <= 0 || $intEveId <= 0
|| !fxEveAccesHasAnyPermission($intComId, $intEveId, array('dossards.manage', 'epreuves.edit_qte'))) {
echo json_encode([
'success' => false,
'message' => fxBibMsg('bib_v4_ajax_unauthorized'),