# app/config/security.yml
security:
    encoders:
        FOS\UserBundle\Model\UserInterface: bcrypt
        UserBundle\Entity\User: bcrypt

    role_hierarchy:
        ROLE_ADMIN:       ROLE_ADMIN
        ROLE_ADHERENT:       ROLE_ADHERENT
        #ROLE_SUPER_ADMIN: ROLE_ADMIN

    providers:
        fos_userbundle:
            id: fos_user.user_provider.username

    firewalls:
        main:
            pattern: ^/
            form_login:
                provider: fos_userbundle
                success_handler: redirect.after.login
                csrf_token_generator: security.csrf.token_manager

            logout:
                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/, role: ROLE_ADMIN }
        - { path: ^/adherent/, role: [ROLE_ADHERENT , ROLE_ADMIN] }