security:
    encoders:
        UserBundle\Entity\User: bcrypt
    providers:
        fos_userbundle:
            id: fos_user.user_provider.username_email

    providers:
        in_memory:
            memory: ~

    firewalls:
        # disables authentication for assets and the profiler, adapt it according to your needs
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false

        main:
            pattern: ^/
            form_login:
                provider: fos_userbundle
                csrf_token_generator: security.csrf.token_manager
                check_path:  fos_user_security_check
                success_handler: redirect.after.login
                remember_me: true

            remember_me:
              secret: '%secret%'
            logout:
                path: fos_user_security_logout
                target: /login
            anonymous:    true

    role_hierarchy:
        ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_USER]
        ROLE_DG: ROLE_USER
        ROLE_HSEQ: ROLE_USER
        ROLE_CHEF: ROLE_USER
        ROLE_AGENT: ROLE_USER
    access_control:
        - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/espace/superAdmin/, role: ROLE_SUPER_ADMIN }
        - { path: ^/espace/DG, role: ROLE_DG }
        - { path: ^/espace/HSEQ, role: ROLE_HSEQ }
        - { path: ^/espace/chef, role: ROLE_CHEF }
        - { path: ^/espace/agent, role: ROLE_AGENT }