restructurer les acces
This commit is contained in:
@ -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)
|
||||
{
|
||||
|
||||
@ -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'),
|
||||
|
||||
Reference in New Issue
Block a user