parameters:
    pim_user.account_lock.duration: 5
    pim_user.account_lock.max_consecutive_failures: 5

services:
    pim_user.manager:
        class: 'Akeneo\UserManagement\Bundle\Manager\UserManager'
        arguments: ['%pim_user.entity.user.class%', "@doctrine.orm.entity_manager", "@security.encoder_factory"]

    pim_user.security.login:
        class: 'Akeneo\UserManagement\Bundle\EventListener\LoginSubscriber'
        arguments: ["@pim_user.manager"]
        tags:
            - { name: kernel.event_listener, event: security.interactive_login, method: onLogin }

    pim_user.role.listener:
        class: 'Akeneo\UserManagement\Bundle\EventListener\RoleListener'
        arguments: ["@oro_security.link.sid_manager"]
        tags:
            - { name: doctrine.event_listener, event: preUpdate }

    pim_user.entity_with_image.subscriber:
        class: 'Akeneo\UserManagement\Bundle\EventListener\UploadedImageSubscriber'
        arguments:
            - '%kernel.project_dir%/src'
        tags:
            - { name: doctrine.event_subscriber }

    security.authentication.provider.dao:
        class: Akeneo\UserManagement\Bundle\Provider\CustomDaoAuthenticationProvider
        abstract: true
        arguments:
            - ''
            - ''
            - ''
            - '@security.encoder_factory'
            - '@pim_user.manager'
            - '%pim_user.account_lock.duration%'
            - '%pim_user.account_lock.max_consecutive_failures%'
            - '%security.authentication.hide_user_not_found%'

    security.user_checker:
        class: Akeneo\UserManagement\Bundle\Provider\CustomUserChecker
        abstract: false

    Akeneo\UserManagement\back\Application\RestoreAdminRolePermissions:
        arguments:
            - '@oro_security.acl.manager'
            - '@pim_user.factory.role_with_permissions'
            - '@pim_user.repository.role_with_permissions'
            - '@pim_user.saver.role_with_permissions'
