services:

  life_style_dh_access_control.authorization.user_scopes_builder:
    class: LifeStyle\DH\AccessControlBundle\Authorization\UserScopesBuilder
    arguments:
      - '@sso_webservice.database_webservice.user'
      - '@sso_webservice.database_webservice.application'
      - '@security.token_storage'
      - '@life_style_dh_access_control.configuration.scope_access_configuration'
      - '@life_style_dh_access_control.configuration.iam_access_configuration'

  life_style_dh_access_control.configuration.client_configuration:
    class: LifeStyle\DH\AccessControlBundle\Configuration\ClientConfiguration
    public: false
    arguments: ['', '']

  life_style_dh_access_control.configuration.iam_access_configuration:
    class: LifeStyle\DH\AccessControlBundle\Configuration\IamAccessConfiguration
    public: false
    arguments: ['', '']

  life_style_dh_access_control.configuration.scope_access_configuration:
    class: LifeStyle\DH\AccessControlBundle\Configuration\ScopeAccessConfiguration
    public: false
    arguments: ['', '', '']


  life_style_dh_access_control.event_listener.user_advanced_search_filter_event_listener:
    class: LifeStyle\DH\AccessControlBundle\EventListener\UserAdvancedSearchFilterEventListener
    public: true
    arguments:
      - '@security.token_storage'
      - '@sso_access.authorization.temporary_token_authorization_interface'
      - '@life_style_dh_access_control.repository.object_service_repository'
      - '@doctrine.dbal.webservice_connection'
      - '@logger'
      - '@life_style_dh_access_control.authorization.user_scopes_builder'
    tags:
      - { name: kernel.event_listener, event: ws.user_advanced_search.pre_build_conditions, method: onUserAdvancedSearchQueryEvent }

  life_style_dh_access_control.event_listener.user_authorization_listener:
    class: LifeStyle\DH\AccessControlBundle\EventListener\UserAuthorizationListener
    arguments:
      - '@security.token_storage'
      - '@sso_access.authorization.temporary_token_authorization_interface'
      - '@life_style_dh_access_control.repository.object_service_repository'
      - '@logger'
      - '@life_style_dh_access_control.authorization.user_scopes_builder'
    tags:
      - { name: kernel.event_listener, event: ws.user_update.pre_add, method: onUserAdd }
      - { name: kernel.event_listener, event: ws.user_update.pre_update, method: onUserChange }
      - { name: kernel.event_listener, event: ws.user_delete.pre_delete, method: onUserChange }
      - { name: kernel.event_listener, event: ws.user_show.pre_show, method: onUserChange }


  life_style_dh_access_control.object_service.client:
    class: LifeStyle\DH\AccessControlBundle\ObjectService\ClientInterface
    public: false
    factory: 'life_style_dh_access_control.object_service.client_factory:createClient'

  life_style_dh_access_control.object_service.client_factory:
    class: LifeStyle\DH\AccessControlBundle\ObjectService\ClientFactory
    public: false
    arguments:
        - '@life_style_dh_access_control.configuration.client_configuration'
        - '@logger'

  life_style_dh_access_control.repository.object_service_repository:
    class: LifeStyle\DH\AccessControlBundle\Repository\ObjectServiceRepository
    public: false
    arguments:
      - '@life_style_dh_access_control.object_service.client'
