# To get started with security, check out the documentation:
# http://symfony.com/doc/current/security.html
security:
    # http://symfony.com/doc/current/security.html#b-configuring-how-users-are-loaded
    providers:
        admin_provider:
            entity:
                class: AppBundle:Admin
        manager_provider:
            entity:
                class: AppBundle:Manager
                property: email
        advisor_provider:
            entity:
                class: AppBundle:Advisor
                property: email
        sales_manager_provider:
            entity:
                class: AppBundle:SalesManager
                property: email
        sales_agent_provider:
            entity:
                class: AppBundle:SalesAgent
                property: email
        parts_agent_provider:
            entity:
                class: AppBundle:PartsAgent
                property: email
        finance_manager_provider:
            entity:
                class: AppBundle:FinanceManager
                property: email
        technician_provider:
            entity:
                class: AppBundle:Technician
                property: email
        site_provider:
            chain:
                providers: [admin_provider, manager_provider, advisor_provider, sales_manager_provider, sales_agent_provider, parts_agent_provider, finance_manager_provider, technician_provider]
        in_memory:
            memory: ~
    role_hierarchy:
        ROLE_ADMIN: [ROLE_USER, ROLE_MANAGER, ROLE_ADVISOR, ROLE_SALES_MANAGER, ROLE_SALES_AGENT, ROLE_PARTS_AGENT, ROLE_TECHNICIAN]
        ROLE_MANAGER: ROLE_USER, ROLE_ADVISOR
        ROLE_ADVISOR: ROLE_USER
        ROLE_SALES_MANAGER: ROLE_USER, ROLE_SALES_AGENT
        ROLE_SALES_AGENT: ROLE_USER
        ROLE_PARTS_AGENT: ROLE_USER
        ROLE_TECHNICIAN: ROLE_USER
    encoders:
        AppBundle\Entity\Manager:
            algorithm: bcrypt
        AppBundle\Entity\Advisor:
            algorithm: bcrypt
        AppBundle\Entity\SalesManager:
            algorithm: bcrypt
        AppBundle\Entity\SalesAgent:
            algorithm: bcrypt
        AppBundle\Entity\PartsAgent:
            algorithm: bcrypt
        AppBundle\Entity\FinanceManager:
            algorithm: bcrypt
        AppBundle\Entity\Technician:
            algorithm: bcrypt
    firewalls:
        secured_area:
            pattern: ^/
            provider: site_provider
            anonymous: ~
            form_login:
                login_path: authentication_login
                default_target_path:
            logout:
                path: authentication_logout
                target: authentication_login_router
        # disables authentication for assets and the profiler, adapt it according to your needs
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        main:
            anonymous: ~
            # activate different ways to authenticate

            # http_basic: ~
            # http://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate

            # form_login: ~
            # http://symfony.com/doc/current/cookbook/security/form_login_setup.html
    access_control:
        - { path: ^/api/iservice/advisor, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/preview/lead/new-external, roles: IS_AUTHENTICATED_ANONYMOUSLY}
        - { path: ^/api/sales/, roles: IS_AUTHENTICATED_ANONYMOUSLY}
        - { path: ^/api/upgrade/, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/preview/app/, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/preview/customer-app/, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/preview/client-interaction/new, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/preview/lead-interaction/new, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/waiver/send-welcome, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/isa-menu, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/sparrow/get-kpi, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/sparrow/send-kpi, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/sparrow/send-historical-kpi, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/messages/twilio-incoming, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/preview/sales-sms/handle-incoming, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/app, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/preview/app, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/spotlight/get-videos, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/client-interaction/new, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/repair-order-quote/approve, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/authentication/check_login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/authentication/get-security-question, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/authentication/forgot-password, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/nmi/process-transaction, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/nmi/process-finance-transaction, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/nmi/process-parts-transaction, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/nmi/send-receipt, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/nmi/send-parts-receipt, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/nmi/send-finance-receipt, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/support/send-email, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/myloan/create-application, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/myloan/send-application, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/myloan/get-userid, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/api/kraken/*, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/forgot-password, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/reset-password, roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/iservice/mpi/report/(.+), roles: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/, roles: ROLE_USER }
