Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 55 additions & 54 deletions config/packages/backoffice_menu.yaml

Large diffs are not rendered by default.

51 changes: 32 additions & 19 deletions config/packages/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,15 @@ security:
- { path: ^/event/vote/, roles: ROLE_GITHUB }
- { path: ^(/event/.*/(vote|cfp|speaker-infos)|/connect/github/check|/event/speaker-infos), roles: ROLE_GITHUB }
- { path: ^/(login|register|password-reset), roles: PUBLIC_ACCESS }
- { path: ^/admin/techletter/members, roles: ROLE_ADMIN }
- { path: ^/admin/techletter, roles: ROLE_VEILLE }
- { path: ^/admin/company, roles: ROLE_COMPANY_MANAGER }
- { path: ^/admin/members/badges, roles: ROLE_ADMIN }
- { path: ^/admin/members/users, roles: ROLE_ADMIN }
- { path: ^/admin/members/companies, roles: ROLE_ADMIN }
- { path: ^/admin/event/speakers-management, roles: ROLE_FORUM }
- { path: ^/admin/event/interviews, roles: ROLE_FORUM }
- { path: ^/admin/event, roles: ROLE_ADMIN }
- { path: ^/admin/members/general_meeting, roles: ROLE_ADMIN }
- { path: ^/admin/members/general_meeting_vote, roles: ROLE_ADMIN }
- { path: ^/admin/site, roles: ROLE_ADMIN }
- { path: ^/admin/planete, roles: ROLE_ADMIN }
- { path: ^/admin/accounting, roles: ROLE_ADMIN }
- { path: ^/admin/(members/reporting|association/relances|talk|slackmembers/check|healthcheck), roles: ROLE_ADMIN}
- { path: ^/member, roles: [ROLE_USER, ROLE_MEMBER_EXPIRED]}
- { path: ^/admin/, roles: ROLE_MEMBER_EXPIRED }
- { path: ^/member, roles: [ROLE_USER, ROLE_MEMBER_EXPIRED] }
Comment thread
Korbeil marked this conversation as resolved.
Resolved
# ─── Redirections legacy du domaine authentification (login/logout/password) : publiques ───
- { path: ^/admin/(login|logout|password), roles: PUBLIC_ACCESS }
# ─── Console : toute personne ayant un rôle fonctionnel (READ ⩾) passe
# (dashboard /admin/ compris) ; anonymes → redirection login,
# membres simples → 403. ───
- { path: ^/admin, roles: ROLE_ADMIN }
# ─── 4 pages SUPER_ADMIN (administrators, logs, healthcheck, techletter/members) :
# fermées par attributs #[IsGranted] en code, pas par YAML ───
- { path: ^/blog, allow_if: "request.getClientIp() in ['217.70.189.71', '127.0.0.1', '192.168.42.1'] or request.server.get('ALLOW_BLOG_FROM_ALL') == 1 or request.headers.get('x-afup-blog-api-key') == '%env(BLOG_API_KEY)%'" }
- { path: ^/blog, roles: ROLE_NO_ACCESS }
- { path: ^/(event/\w+/tickets|association)paybox-callback, roles: PUBLIC_ACCESS, ips: "%paybox_ips%" }
Expand All @@ -78,5 +70,26 @@ security:
role_hierarchy:
ROLE_USER: [ROLE_MEMBER_EXPIRED]
ROLE_COMPANY_MANAGER: [ROLE_USER]
ROLE_ADMIN: [ROLE_USER, ROLE_DEPLOY, ROLE_APERO, ROLE_ANNUAIRE, ROLE_FORUM, ROLE_SITE, ROLE_VEILLE]
ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
# ─── Marqueur console vide : ne donne accès à rien ───
Comment thread
stakovicz marked this conversation as resolved.
Resolved
ROLE_ADMIN: []
# ─── READ ⇒ console + WRITE ⇒ READ ───
ROLE_MEMBRES_READER: [ROLE_ADMIN]
ROLE_MEMBRES_WRITER: [ROLE_MEMBRES_READER]
ROLE_VEILLE_READER: [ROLE_ADMIN]
ROLE_VEILLE_WRITER: [ROLE_VEILLE_READER]
ROLE_SITE_READER: [ROLE_ADMIN]
ROLE_SITE_WRITER: [ROLE_SITE_READER]
ROLE_APERO_READER: [ROLE_ADMIN]
ROLE_APERO_WRITER: [ROLE_APERO_READER]
ROLE_EVENT_READER: [ROLE_ADMIN]
ROLE_EVENT_WRITER: [ROLE_EVENT_READER]
ROLE_COMPTA_READER: [ROLE_ADMIN]
ROLE_COMPTA_WRITER: [ROLE_COMPTA_READER]
ROLE_AG_READER: [ROLE_ADMIN]
ROLE_AG_WRITER: [ROLE_AG_READER]
ROLE_PLANETE_READER: [ROLE_ADMIN]
ROLE_PLANETE_WRITER: [ROLE_PLANETE_READER]
ROLE_ANTENNES_READER: [ROLE_ADMIN]
ROLE_ANTENNES_WRITER: [ROLE_ANTENNES_READER]
# ─── Super admin : tout READ via les WRITER + impersonation ───
ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH, ROLE_MEMBRES_WRITER, ROLE_VEILLE_WRITER, ROLE_SITE_WRITER, ROLE_APERO_WRITER, ROLE_EVENT_WRITER, ROLE_COMPTA_WRITER, ROLE_AG_WRITER, ROLE_PLANETE_WRITER, ROLE_ANTENNES_WRITER]
2 changes: 1 addition & 1 deletion config/routing/admin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ admin_super_apero:

admin_members_reporting:
path: /members/reporting
defaults: {_controller: AppBundle\Controller\MembershipAdmin\ReportingAction}
defaults: {_controller: AppBundle\Controller\Admin\Members\ReportingAction}

admin_members_general_meeting:
path: /members/general_meeting
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

/**
* Les droits d'accès au back-office sont désormais portés uniquement par la colonne roles.
*
* Cette migration ne fait que le changement de schéma :
* - roles passe en text (avec les rôles de modules, la liste peut dépasser 255 caractères) ;
* - les colonnes niveau / niveau_modules sont supprimées.
*
* Le wipe des droits (rôles admin / legacy / de modules retirés, seuls ROLE_MEMBER_*
* et ROLE_COMPANY_MANAGER conservés) est fait via la commande console
* bin/console security:reset-backoffice-roles, à lancer manuellement.
*/
class RolesRemplacentNiveauModules extends AbstractMigration
{
public function up(): void
{
// Avec les rôles des modules, la liste peut dépasser 255 caractères
$this->table('afup_personnes_physiques')
->changeColumn('roles', 'text', ['null' => false])
->save();

$this->table('afup_personnes_physiques')
->removeColumn('niveau')
->removeColumn('niveau_modules')
->save();
}

public function down(): void
{
// Les anciens droits ne sont pas récupérables : le retour arrière ne remet que le schéma
if (!$this->table('afup_personnes_physiques')->hasColumn('niveau')) {
$this->table('afup_personnes_physiques')
->addColumn('niveau', 'integer', ['limit' => 255, 'signed' => false, 'default' => 0, 'after' => 'mot_de_passe'])
->addColumn('niveau_modules', 'char', ['limit' => 10, 'default' => '', 'after' => 'niveau'])
->save();
}
}
}
30 changes: 15 additions & 15 deletions db/seeds/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class Users extends AbstractSeed
public const ID_USER_PERSONNE_PHYSIQUE = 5;
public const ID_USER_PERSONNE_PHYSIQUE_FIXED_COTISATIONS = 6;
public const ID_USER_PERSONNE_LIE_PERSONNE_MORALE_FIXED_COTISATIONS = 7;
public const ID_USER_GESTIONNAIRE_MEMBRES = 8;

public const ID_PERSONNE_MORALE_MY_CORP = 1;
public const ID_PERSONNE_MORALE_HELIOS_AEROSPACE = 2;
Expand Down Expand Up @@ -70,11 +71,10 @@ public function run(): void
'login' => 'admin',
'mot_de_passe' => md5('admin'),
'nom' => 'Admin',
'niveau' => 2, // AFUP_DROITS_NIVEAU_ADMINISTRATEUR,
'prenom' => 'Admin',
'email' => 'admin@admin.fr',
'niveau_modules' => '00000',
'roles' => '',
// La hiérarchie (config/packages/security.yaml) donne tous les *_WRITER au super admin
'roles' => json_encode(['ROLE_SUPER_ADMIN']),
'adresse' => '',
],
// utilisateur ayant expiré, avec une date de cotisation fixe, utile pour les tests
Expand All @@ -83,10 +83,8 @@ public function run(): void
'login' => 'userexpire',
'mot_de_passe' => md5('userexpire'),
'nom' => 'Maurice',
'niveau' => 0, // AFUP_DROITS_NIVEAU_MEMBRE,
'prenom' => 'Jean',
'email' => 'userexpire@yahoo.fr',
'niveau_modules' => '00000',
'roles' => '',
'adresse' => '',
],
Expand All @@ -96,10 +94,8 @@ public function run(): void
'login' => 'cpike',
'mot_de_passe' => md5('cpike'),
'nom' => 'Pike',
'niveau' => 0, // AFUP_DROITS_NIVEAU_MEMBRE,
'prenom' => 'Christopher',
'email' => 'cpike@strafleet.fr',
'niveau_modules' => '00000',
'adresse' => '15, main road',
'code_postal' => '93501-1100',
'ville' => 'Mojave, CA',
Expand All @@ -110,38 +106,32 @@ public function run(): void
'login' => 'dayesa',
'mot_de_passe' => md5('dayesa'),
'nom' => 'Ayesa',
'niveau' => 0, // AFUP_DROITS_NIVEAU_MEMBRE,
'prenom' => 'Dev',
'email' => 'dev.ayesa@helios-aerospace.com',
'roles' => '["ROLE_COMPANY_MANAGER"]',
'id_personne_morale' => self::ID_PERSONNE_MORALE_HELIOS_AEROSPACE,
'niveau_modules' => '00000',
'adresse' => '',
],
[
'id' => self::ID_USER_PERSONNE_MORALE,
'login' => 'edmonddupont',
'mot_de_passe' => md5('edmonddupont'),
'nom' => 'Dupont',
'niveau' => 0, // AFUP_DROITS_NIVEAU_MEMBRE,
'prenom' => 'Edmond',
'email' => 'edmond.dupont@mycorp.fr',
'roles' => '["ROLE_COMPANY_MANAGER"]',
'id_personne_morale' => self::ID_PERSONNE_MORALE_MY_CORP,
'niveau_modules' => '00000',
'adresse' => '',
],
[
'id' => self::ID_USER_PERSONNE_MORALE_NON_MANAGER,
'login' => 'raoul',
'mot_de_passe' => md5('raoul'),
'nom' => 'Raoul',
'niveau' => 0, // AFUP_DROITS_NIVEAU_MEMBRE,
'prenom' => 'Jan',
'email' => 'jean.raoul@mycorp.fr',
'roles' => '[]',
'id_personne_morale' => self::ID_PERSONNE_MORALE_MY_CORP,
'niveau_modules' => '00000',
'etat' => 1,
'adresse' => '',
],
Expand All @@ -151,11 +141,21 @@ public function run(): void
'mot_de_passe' => md5('paul'),
'nom' => 'Paul',
'prenom' => 'Personne',
'niveau' => 0, // AFUP_DROITS_NIVEAU_MEMBRE,
'email' => 'paul.personne@mycorp.fr',
'roles' => '[]',
'etat' => User::STATUS_ACTIVE,
'niveau_modules' => '00000',
'adresse' => '',
],
// gestionnaire du module Membres, sans être super admin
[
'id' => self::ID_USER_GESTIONNAIRE_MEMBRES,
'login' => 'gestionmembres',
'mot_de_passe' => md5('gestionmembres'),
'nom' => 'Zorglub',
'prenom' => 'Gestion',
'email' => 'gestion.membres@afup.test',
'roles' => json_encode(['ROLE_MEMBRES_WRITER']),
'etat' => User::STATUS_ACTIVE,
'adresse' => '',
],
];
Expand Down
Loading
Loading