security:
    password_hashers:
        Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: auto

    role_hierarchy:
        ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_PRESIDENTE, ROLE_REDACTRICE, ROLE_NATIONAL, ROLE_REGIONAL, ROLE_ALLOWED_TO_SWITCH]
        ROLE_ADMIN:       [ROLE_USER, ROLE_PRESIDENTE, ROLE_REDACTRICE, ROLE_REGIONAL, ROLE_NATIONAL]
        ROLE_PRESIDENTE:  [ROLE_USER, ROLE_REDACTRICE]
        ROLE_REDACTRICE:  [ROLE_USER, ROLE_REDACTRICE]
        ROLE_NATIONAL: [ROLE_USER, ROLE_PRESIDENTE, ROLE_REDACTRICE, ROLE_REGIONAL]
        ROLE_REGIONAL: [ROLE_USER, ROLE_PRESIDENTE, ROLE_REDACTRICE]    

    providers:
        fos_userbundle:
            entity:
                class: Cyberl\UserBundle\Entity\User
                property: username

    firewalls:
        dev:
            pattern:  ^/(_(profiler|wdt)|css|images|js)/
            security: false

        # -> custom firewall for the admin area of the URL
        admin:
            pattern:      /admin(.*)
            lazy:         true
            form_login:
                provider:       fos_userbundle
                login_path:     /admin/login
                use_forward:    false
                check_path:     /admin/login_check
                failure_path:   null
                default_target_path: /admin/dashboard
            logout:
                path:           /admin/logout
        # -> end custom configuration

        # Firewall principal pour le reste de notre site
        main:
            pattern: ^/                      # ^/ = tout ce qui commence par / = tout notre site
            lazy:         true
            form_login:                      # On définit notre méthode d'authentification
                provider:    fos_userbundle  # On lit l'authentification au provider définit plus haut
                login_path:  fos_user_security_login
                check_path:  fos_user_security_check
                remember_me: true            # On active la possibilité du "Se souvenir de moi" (désactivé par défaut)
                always_use_default_target_path : false
                default_target_path: /mon_compte/accueil
            remember_me:
                secret:         '%secret%'        # On définit la clé pour le remember_me (%secret% est un parametre de parameters.ini)
            logout:
                path:        fos_user_security_logout
                target:      /

    access_control:
        # URL of FOSUserBundle which need to be available to anonymous users
        - { path: ^/_wdt, role: PUBLIC_ACCESS }
        - { path: ^/_profiler, role: PUBLIC_ACCESS }
        - { path: ^/login$, role: PUBLIC_ACCESS }
        - { path: ^/paiements/mercanet/returnCotisationCarte$, role: PUBLIC_ACCESS }
 
        # -> custom access control for the admin area of the URL
        - { path: ^/admin/login$, role: PUBLIC_ACCESS }
        - { path: ^/admin/logout$, role: PUBLIC_ACCESS }
        - { path: ^/admin/login-check$, role: PUBLIC_ACCESS }
        # -> end
 
        - { path: ^/register, role: PUBLIC_ACCESS }
        - { path: ^/resetting, role: PUBLIC_ACCESS }
 
        # Secured part of the site
        # This config requires being logged for the whole site and having the admin role for the admin part.
        # Change these rules to adapt them to your needs
                #Media
        - { path: ^/media/download, role: ROLE_USER }
        - { path: ^/admin, role: [ROLE_ADMIN, ROLE_SONATA_ADMIN] }
        - { path: ^/.*, role: PUBLIC_ACCESS }