security:
    providers:
        fos_userbundle:
            id: fos_user.user_provider.username_email

    encoders:
        FOS\UserBundle\Model\UserInterface: sha512

    firewalls:
        main:
            pattern: ^/
            form_login:
                provider: fos_userbundle
                login_path: /user/login
                check_path: /user/login_check
                default_target_path: _admin_backend_index
                always_use_default_target_path: true
                csrf_token_generator: security.csrf.token_manager
            logout:
                path: fos_user_security_logout
                target: _admin_backend_welcome
            anonymous: true

    access_control:
        # URL of FOSUserBundle which need to be available to anonymous users
        - { path: ^/_wdt, role: ROLE_ADMIN }
        - { path: ^/_profiler, role: ROLE_ADMIN }
        - { path: ^/user/login, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/user/logout, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/register, role: ROLE_ADMIN }
        - { path: ^/resetting, role: ROLE_ADMIN }
        - { path: ^/admin/welcome$, role: ROLE_ADMIN }
        # -> custom access control for the admin area of the URL
        - { path: ^/admin/webservice, role: ROLE_USER_ADMIN }
        - { path: ^/admin/service, role: ROLE_SERVICE_ADMIN }
        - { path: ^/admin/token, role: ROLE_SERVICE_ADMIN }
        - { path: ^/admin/systemlog, role: ROLE_SERVICE_ADMIN }
        - { path: ^/admin/security, role: ROLE_SUPER_ADMIN }
        - { path: ^/admin, role: ROLE_ADMIN }
        - { path: ^/demo, role: ROLE_SERVICE_ADMIN }
        - { path: ^/help, role: ROLE_ADMIN }
    role_hierarchy:
        ROLE_ADMIN:         ROLE_USER
        ROLE_APP_ADMIN:     ROLE_ADMIN
        ROLE_USER_ADMIN:    ROLE_ADMIN
        ROLE_SERVICE_ADMIN: ROLE_ADMIN
        ROLE_SUPER_ADMIN:  [ROLE_SERVICE_ADMIN,ROLE_USER_ADMIN]
