security:
    encoders:
        FOS\UserBundle\Model\UserInterface: bcrypt

    role_hierarchy:
        ROLE_ADMIN:       [ROLE_ADMIN, ROLE_PAGE, ROLE_BUREAU, ROLE_HISTORIQUE, ROLE_SLIDER, ROLE_DOCUMENT, ROLE_MANAGEMENT_CONTACT, ROLE_NEWS_CATEGORY, ROLE_BANNIERE, ROLE_AGENDA_EVENEMENT, ROLE_NEWSLETTER, ROLE_AGENDA_RDV, ROLE_MANAGEMENT_ADHER, ROLE_BE, ROLE_ADHERANT, ROLE_USER, ROLE_ALLOWED_TO_SWITCH]
        ROLE_PAGE:        [ROLE_PAGE, ROLE_BE]
        ROLE_BUREAU:        [ROLE_BUREAU, ROLE_BE]
        ROLE_HISTORIQUE:        [ROLE_HISTORIQUE, ROLE_BE]
        ROLE_SLIDER:        [ROLE_SLIDER, ROLE_BE]
        ROLE_CATEGORY:    [ROLE_CATEGORY, ROLE_BE]
        ROLE_NEWS_CATEGORY:        [ROLE_NEWS_CATEGORY, ROLE_BE]
        ROLE_BANNIERE:        [ROLE_BANNIERE, ROLE_BE]
        ROLE_AGENDA_EVENEMENT:        [ROLE_AGENDA_EVENEMENT, ROLE_BE]
        ROLE_NEWSLETTER:        [ROLE_NEWSLETTER, ROLE_BE]
        ROLE_AGENDA_RDV:        [ROLE_AGENDA_RDV, ROLE_BE]
        ROLE_MANAGEMENT_ADHER:        [ROLE_MANAGEMENT_ADHER, ROLE_BE]
        ROLE_MANAGEMENT_CONTACT:        [ROLE_MANAGEMENT_CONTACT, ROLE_BE]
        ROLE_DOCUMENT:        [ROLE_DOCUMENT, ROLE_BE]
        ROLE_BE:          [ROLE_BE, ROLE_ADHERANT]
        ROLE_ADHERANT:    [ROLE_ADHERANT, ROLE_USER]
        ROLE_USER:        [ROLE_USER]

    providers:
        fos_userbundle:
             id: fos_user.user_provider.username_email

    firewalls:
        main:
            pattern: ^/
            form_login:
                provider: fos_userbundle
                csrf_token_generator: security.csrf.token_manager
                login_path: fos_user_security_login
                check_path: fos_user_security_check
#                requirements:
#                            _locale: fr|en
#                requirements:
#                    _locale: fr|en
                success_handler: redirect.after.login
                # if you are using Symfony < 2.8, use the following config instead:
                # csrf_provider: form.csrf_provider

            logout:
                path:  fos_user_security_logout
                target: fos_user_security_login
#                requirements:
#                    _locale: fr|en
                #success_handler: redirect.after.logout
            anonymous:    true

    access_control:
        - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/admin/adherant/list, role:[ROLE_ADMIN, ROLE_BE]}
        - { path: ^/admin/adherant/view-details, role:[ROLE_ADMIN, ROLE_BE]}
        - { path: ^/admin/, role: [ROLE_ADMIN] }
        - { path: ^/be/, role: [ROLE_BE,ROLE_ADMIN] }
        - { path: ^/adherant/, role: ROLE_ADHERANT }