Refactor event access management to support V2 features, updating permission checks and enhancing UI elements for better user experience. Remove legacy API keys and streamline access permissions in fxEveAcces functions. This aligns with MSIN-4401 requirements for improved event management functionality.
This commit is contained in:
227
sql/MSIN-4401-eve-acces-v2-pages-niveau1.sql
Normal file
227
sql/MSIN-4401-eve-acces-v2-pages-niveau1.sql
Normal file
@ -0,0 +1,227 @@
|
||||
-- MSIN-4401 — Accès V2 : niveau 1 = pages hub, niveau 2 = détails (gardés)
|
||||
-- Ne touche PAS au legacy (com_eve_promoteur).
|
||||
-- Idempotent. Safe pilote.
|
||||
--
|
||||
-- Object :
|
||||
-- 1) Désactiver les anciennes clés « API mobile » (pas d'API mobile en prod)
|
||||
-- 2) Relabel / regrouper les permissions page (menus hub)
|
||||
-- 3) Garder les actions inscriptions_gestion.* (niveau 2)
|
||||
-- 4) Recadrer les kits gestion_* sans events.* / registrations.*
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
1. Anciennes clés API / « mobile » : inactives dans les kits
|
||||
(restent en base au cas où, mais plus proposées ni dans grants_all actif)
|
||||
------------------------------------------------------------------ */
|
||||
UPDATE `inscriptions_eve_permissions`
|
||||
SET `perm_actif` = 0,
|
||||
`perm_label_fr` = CONCAT('[inactif] ', `perm_label_fr`),
|
||||
`perm_description_fr` = 'MSIN-4401 — ancienne clé API/mobile, non utilisée (page web responsive a la place)'
|
||||
WHERE `perm_key` IN ('events.list', 'events.view', 'registrations.view', 'registrations.scan')
|
||||
AND `perm_label_fr` NOT LIKE '[inactif]%';
|
||||
|
||||
/* Retirer ces clés de TOUTES les matrices / extras (plus de grant silencieux) */
|
||||
DELETE FROM `inscriptions_eve_role_permissions`
|
||||
WHERE `perm_key` IN ('events.list', 'events.view', 'registrations.view', 'registrations.scan');
|
||||
|
||||
DELETE FROM `inscriptions_eve_acces_extra`
|
||||
WHERE `perm_key` IN ('events.list', 'events.view', 'registrations.view', 'registrations.scan');
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
2. Niveau 1 — pages du hub (menus)
|
||||
------------------------------------------------------------------ */
|
||||
UPDATE `inscriptions_eve_permissions` SET
|
||||
`perm_group` = 'page_hub',
|
||||
`perm_scope` = 'page',
|
||||
`perm_label_fr` = 'Gestion des inscriptions V2',
|
||||
`perm_label_en` = 'Registration management V2',
|
||||
`perm_description_fr` = 'Menu hub + page /mobile (meme module responsive)',
|
||||
`perm_tri` = 10
|
||||
WHERE `perm_key` = 'inscriptions_gestion.view';
|
||||
|
||||
UPDATE `inscriptions_eve_permissions` SET
|
||||
`perm_group` = 'page_hub',
|
||||
`perm_scope` = 'page',
|
||||
`perm_label_fr` = 'Gestion des quantités et dossards V2',
|
||||
`perm_label_en` = 'Quantities and bibs V2',
|
||||
`perm_description_fr` = 'Menu hub : quantites / dossards v2',
|
||||
`perm_tri` = 20
|
||||
WHERE `perm_key` = 'dossards.manage';
|
||||
|
||||
UPDATE `inscriptions_eve_permissions` SET
|
||||
`perm_group` = 'page_hub',
|
||||
`perm_scope` = 'page',
|
||||
`perm_label_fr` = 'Gestion des rabais',
|
||||
`perm_label_en` = 'Discount management',
|
||||
`perm_description_fr` = 'Menu hub : rabais (controle V2)',
|
||||
`perm_tri` = 30
|
||||
WHERE `perm_key` = 'rabais.view';
|
||||
|
||||
UPDATE `inscriptions_eve_permissions` SET
|
||||
`perm_group` = 'page_hub',
|
||||
`perm_scope` = 'page',
|
||||
`perm_label_fr` = 'Gestion des accès V2',
|
||||
`perm_label_en` = 'Access management V2',
|
||||
`perm_description_fr` = 'Menu hub : invitation / equipe V2',
|
||||
`perm_tri` = 40
|
||||
WHERE `perm_key` = 'team.invite';
|
||||
|
||||
UPDATE `inscriptions_eve_permissions` SET
|
||||
`perm_group` = 'page_hub',
|
||||
`perm_scope` = 'page',
|
||||
`perm_label_fr` = 'Rapport : chrono + questions',
|
||||
`perm_label_en` = 'Report: chrono + questions',
|
||||
`perm_tri` = 50
|
||||
WHERE `perm_key` = 'reports.chrono';
|
||||
|
||||
UPDATE `inscriptions_eve_permissions` SET
|
||||
`perm_group` = 'page_hub',
|
||||
`perm_scope` = 'page',
|
||||
`perm_label_fr` = 'Rapport : Transactions-Finances',
|
||||
`perm_label_en` = 'Report: Transactions-Finances',
|
||||
`perm_tri` = 60
|
||||
WHERE `perm_key` = 'reports.finances';
|
||||
|
||||
UPDATE `inscriptions_eve_permissions` SET
|
||||
`perm_group` = 'page_hub',
|
||||
`perm_scope` = 'page',
|
||||
`perm_label_fr` = 'Rapport : Paiements',
|
||||
`perm_label_en` = 'Report: Payments',
|
||||
`perm_tri` = 70
|
||||
WHERE `perm_key` = 'reports.payments';
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
3. Niveau 2 — details Inscriptions V2 (on garde les cases)
|
||||
------------------------------------------------------------------ */
|
||||
UPDATE `inscriptions_eve_permissions` SET
|
||||
`perm_group` = 'inscriptions_v2',
|
||||
`perm_scope` = 'action',
|
||||
`perm_tri` = 110
|
||||
WHERE `perm_key` = 'inscriptions_gestion.statut_edit';
|
||||
|
||||
UPDATE `inscriptions_eve_permissions` SET
|
||||
`perm_group` = 'inscriptions_v2',
|
||||
`perm_scope` = 'action',
|
||||
`perm_tri` = 120
|
||||
WHERE `perm_key` = 'inscriptions_gestion.bib_edit';
|
||||
|
||||
UPDATE `inscriptions_eve_permissions` SET
|
||||
`perm_group` = 'inscriptions_v2',
|
||||
`perm_scope` = 'action',
|
||||
`perm_tri` = 130
|
||||
WHERE `perm_key` = 'inscriptions_gestion.bib_remis';
|
||||
|
||||
UPDATE `inscriptions_eve_permissions` SET
|
||||
`perm_group` = 'inscriptions_v2',
|
||||
`perm_scope` = 'action',
|
||||
`perm_tri` = 140
|
||||
WHERE `perm_key` = 'inscriptions_gestion.edit';
|
||||
|
||||
UPDATE `inscriptions_eve_permissions` SET
|
||||
`perm_group` = 'inscriptions_v2',
|
||||
`perm_scope` = 'action',
|
||||
`perm_tri` = 150
|
||||
WHERE `perm_key` = 'inscriptions_gestion.cancel';
|
||||
|
||||
UPDATE `inscriptions_eve_permissions` SET
|
||||
`perm_group` = 'inscriptions_v2',
|
||||
`perm_scope` = 'action',
|
||||
`perm_tri` = 160
|
||||
WHERE `perm_key` = 'inscriptions_gestion.restore';
|
||||
|
||||
UPDATE `inscriptions_eve_permissions` SET
|
||||
`perm_group` = 'inscriptions_v2',
|
||||
`perm_scope` = 'action',
|
||||
`perm_tri` = 170
|
||||
WHERE `perm_key` = 'inscriptions_gestion.refund';
|
||||
|
||||
/* Autres droits (niveau 2 futur / complement) */
|
||||
UPDATE `inscriptions_eve_permissions` SET `perm_group` = 'dossards_detail', `perm_scope` = 'action', `perm_tri` = 210
|
||||
WHERE `perm_key` = 'dossards.view';
|
||||
UPDATE `inscriptions_eve_permissions` SET `perm_group` = 'dossards_detail', `perm_scope` = 'action', `perm_tri` = 220
|
||||
WHERE `perm_key` = 'epreuves.view';
|
||||
UPDATE `inscriptions_eve_permissions` SET `perm_group` = 'dossards_detail', `perm_scope` = 'action',
|
||||
`perm_label_fr` = 'Épreuves : quantités (détail)',
|
||||
`perm_tri` = 230
|
||||
WHERE `perm_key` = 'epreuves.edit_qte';
|
||||
|
||||
UPDATE `inscriptions_eve_permissions` SET `perm_group` = 'rabais_detail', `perm_scope` = 'action', `perm_tri` = 310
|
||||
WHERE `perm_key` = 'rabais.manage';
|
||||
|
||||
UPDATE `inscriptions_eve_permissions` SET `perm_group` = 'acces_detail', `perm_scope` = 'action', `perm_tri` = 410
|
||||
WHERE `perm_key` IN ('team.view', 'team.manage');
|
||||
|
||||
UPDATE `inscriptions_eve_permissions` SET `perm_group` = 'rapports_autres', `perm_scope` = 'page', `perm_tri` = 510
|
||||
WHERE `perm_key` IN (
|
||||
'reports.finances_membership', 'reports.finances_events', 'reports.adhesions',
|
||||
'reports.adhesions_sales', 'reports.finances_captains', 'reports.custom'
|
||||
);
|
||||
|
||||
UPDATE `inscriptions_eve_permissions` SET `perm_group` = 'autre', `perm_scope` = 'page', `perm_tri` = 900
|
||||
WHERE `perm_key` IN ('inscriptions.view', 'inscriptions.edit', 'emails.send', 'tools.qr_test');
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
4. Kits gestion_* : pages + details, sans API
|
||||
------------------------------------------------------------------ */
|
||||
DELETE erp FROM inscriptions_eve_role_permissions erp
|
||||
INNER JOIN inscriptions_eve_roles r ON r.role_id = erp.role_id
|
||||
WHERE r.role_code = 'gestion_ops';
|
||||
|
||||
INSERT INTO inscriptions_eve_role_permissions (role_id, perm_key)
|
||||
SELECT r.role_id, p.perm_key
|
||||
FROM inscriptions_eve_roles r
|
||||
INNER JOIN inscriptions_eve_permissions p
|
||||
ON p.perm_key IN (
|
||||
'inscriptions_gestion.view',
|
||||
'inscriptions_gestion.statut_edit', 'inscriptions_gestion.bib_edit',
|
||||
'inscriptions_gestion.bib_remis', 'inscriptions_gestion.edit',
|
||||
'inscriptions_gestion.cancel', 'inscriptions_gestion.restore'
|
||||
)
|
||||
AND p.perm_actif = 1
|
||||
WHERE r.role_code = 'gestion_ops';
|
||||
|
||||
DELETE erp FROM inscriptions_eve_role_permissions erp
|
||||
INNER JOIN inscriptions_eve_roles r ON r.role_id = erp.role_id
|
||||
WHERE r.role_code = 'gestion_readonly';
|
||||
|
||||
INSERT INTO inscriptions_eve_role_permissions (role_id, perm_key)
|
||||
SELECT r.role_id, p.perm_key
|
||||
FROM inscriptions_eve_roles r
|
||||
INNER JOIN inscriptions_eve_permissions p
|
||||
ON p.perm_key IN ('inscriptions_gestion.view')
|
||||
AND p.perm_actif = 1
|
||||
WHERE r.role_code = 'gestion_readonly';
|
||||
|
||||
DELETE erp FROM inscriptions_eve_role_permissions erp
|
||||
INNER JOIN inscriptions_eve_roles r ON r.role_id = erp.role_id
|
||||
WHERE r.role_code = 'gestion_statut';
|
||||
|
||||
INSERT INTO inscriptions_eve_role_permissions (role_id, perm_key)
|
||||
SELECT r.role_id, p.perm_key
|
||||
FROM inscriptions_eve_roles r
|
||||
INNER JOIN inscriptions_eve_permissions p
|
||||
ON p.perm_key IN (
|
||||
'inscriptions_gestion.view',
|
||||
'inscriptions_gestion.statut_edit',
|
||||
'inscriptions_gestion.bib_remis'
|
||||
)
|
||||
AND p.perm_actif = 1
|
||||
WHERE r.role_code = 'gestion_statut';
|
||||
|
||||
UPDATE `inscriptions_eve_roles` SET
|
||||
`role_label_fr` = 'Gestion des statuts',
|
||||
`role_description_fr` = 'Page Inscriptions V2 : consulter + modifier les statuts (et dossard remis). Droits minimaux.'
|
||||
WHERE `role_code` = 'gestion_statut';
|
||||
|
||||
/* Owner : re-sync uniquement permissions actives */
|
||||
DELETE erp FROM inscriptions_eve_role_permissions erp
|
||||
INNER JOIN inscriptions_eve_roles r ON r.role_id = erp.role_id
|
||||
WHERE r.role_code = 'owner';
|
||||
|
||||
INSERT INTO inscriptions_eve_role_permissions (role_id, perm_key)
|
||||
SELECT r.role_id, p.perm_key
|
||||
FROM inscriptions_eve_roles r
|
||||
CROSS JOIN inscriptions_eve_permissions p
|
||||
WHERE r.role_code = 'owner'
|
||||
AND p.perm_actif = 1;
|
||||
Reference in New Issue
Block a user