parameters:
    oro_user.manager.class:                       Oro\Bundle\UserBundle\Entity\UserManager
    oro_user.manager.api.class:                   Oro\Bundle\SoapBundle\Entity\Manager\ApiEntityManager
    oro_user.status.manager.class:                Oro\Bundle\UserBundle\Entity\Manager\StatusManager
    oro_user.entity.class:                        Oro\Bundle\UserBundle\Entity\User
    oro_user.group.entity.class:                  Oro\Bundle\UserBundle\Entity\Group
    oro_user.role.entity.class:                   Oro\Bundle\UserBundle\Entity\Role
    oro_user.security.provider.class:             Oro\Bundle\UserBundle\Security\UserProvider
    oro_user.security.login.class:                Oro\Bundle\UserBundle\EventListener\LoginSubscriber
    oro_user.acl.twig.class:                      Oro\Bundle\UserBundle\Twig\OroUserExtension
    oro_user.user_menu.builder.class:             Oro\Bundle\UserBundle\Menu\UserMenuBuilder
    oro_user.role.listener.class:                 Oro\Bundle\UserBundle\EventListener\RoleListener
    oro_user.role.manager.class:                  Oro\Bundle\UserBundle\Entity\Manager\RoleManager
    oro_user.role.manager.api.class:              Oro\Bundle\SoapBundle\Entity\Manager\ApiEntityManager
    oro_user.group.manager.class:                 Oro\Bundle\UserBundle\Entity\Manager\GroupManager
    oro_user.group.manager.api.class:             Oro\Bundle\SoapBundle\Entity\Manager\ApiEntityManager
    oro_user.autocomplete.user.search_handler:    Oro\Bundle\UserBundle\Autocomplete\UserSearchHandler
    oro_user.autocomplete.user.search_acl_handler.class: Oro\Bundle\UserBundle\Autocomplete\UserAclHandler
    oro_user.email.owner.provider.class:          Oro\Bundle\UserBundle\Entity\Provider\EmailOwnerProvider
    oro_user.gender_provider.class:               Oro\Bundle\UserBundle\Provider\GenderProvider
    oro_user.change_password.subscriber.class:    Oro\Bundle\UserBundle\Form\EventListener\ChangePasswordSubscriber
    oro_user.handler.delete.class:                Oro\Bundle\UserBundle\Handler\UserDeleteHandler
    oro_user.role.handler.delete.class:           Oro\Bundle\UserBundle\Handler\RoleDeleteHandler
    oro_user.activity_widget_provider.class:      %oro_activity.widget_provider.activities.menu.class%
    oro_user.event_listener.owner_user_grid_listener.class: Oro\Bundle\UserBundle\EventListener\OwnerUserGridListener
services:
    oro_user.manager:
        class:                        %oro_user.manager.class%
        arguments:                    [%oro_user.entity.class%, "@doctrine.orm.entity_manager", "@security.encoder_factory"]

    oro_user.manager.api:
        class: %oro_user.manager.api.class%
        parent: oro_soap.manager.entity_manager.abstract
        arguments:
            - %oro_user.entity.class%
            - @doctrine.orm.entity_manager

    oro_user.security.provider:
        class:                        %oro_user.security.provider.class%
        public:                       false
        arguments:                    ["@oro_user.manager"]

    oro_user.security.login:
        class:                        %oro_user.security.login.class%
        arguments:                    ["@oro_user.manager"]
        tags:
            - { name: kernel.event_listener, event: security.interactive_login, method: onLogin }

    oro_user.cache:
        parent: oro.cache.abstract
        calls:
            - [ setNamespace, [ "oro_user.cache" ] ]

    oro_user.user_menu:
        class:                        %oro_user.user_menu.builder.class%
        arguments:
            - @security.context
        tags:
            - { name: oro_menu.builder, alias: usermenu }

    oro_user.role.listener:
        class:                        %oro_user.role.listener.class%
        arguments:                    ["@oro_security.link.sid_manager"]
        tags:
            - { name: doctrine.event_listener, event: preUpdate }

    oro_user.twig.user_extension:
        class:                        %oro_user.acl.twig.class%
        arguments:                    ["@oro_user.gender_provider"]
        tags:
            - { name: twig.extension }

    oro_user.status_manager:
        class:                        %oro_user.status.manager.class%
        arguments:                    ["@doctrine.orm.entity_manager", "@oro_user.manager"]

    oro_user.role_manager:
        class:                        %oro_user.role.manager.class%
        arguments:                    ["@doctrine.orm.entity_manager"]

    oro_user.role_manager.api:
        class: %oro_user.role.manager.api.class%
        parent: oro_soap.manager.entity_manager.abstract
        arguments:
            - %oro_user.role.entity.class%
            - @doctrine.orm.entity_manager

    oro_user.group_manager:
        class:                        %oro_user.group.manager.class%
        arguments:                    ["@doctrine.orm.entity_manager"]

    oro_user.group_manager.api:
        class: %oro_user.group.manager.api.class%
        parent: oro_soap.manager.entity_manager.abstract
        arguments:
            - %oro_user.group.entity.class%
            - @doctrine.orm.entity_manager

    # Autocomplete acl user search handler
    oro_user.autocomplete.user.search_acl_handler:
        class: %oro_user.autocomplete.user.search_acl_handler.class%
        arguments:
            - @doctrine.orm.entity_manager
            - @oro_attachment.manager
            - %oro_user.entity.class%
            - ["id", "username", "namePrefix", "firstName", "middleName", "lastName", "nameSuffix", "email"]
            - @oro_entity_config.link.security_context
            - @oro_security.ownership_tree_provider
            - @?security.acl.voter.basic_permissions
        calls:
            - [ setNameFormatter, [@oro_locale.formatter.name] ]
        tags:
            - { name: oro_form.autocomplete.search_handler, alias: acl_users, acl_resource: oro_user_user_view }
        lazy: true

    # Autocomplete search handler
    oro_user.autocomplete.user.search_handler:
        class: %oro_user.autocomplete.user.search_handler%
        parent: oro_form.autocomplete.full_name.search_handler
        arguments:
            - @oro_attachment.manager
            - %oro_user.entity.class%
            - ["username", "namePrefix", "firstName", "middleName", "lastName", "nameSuffix", "email"]
        tags:
            - { name: oro_form.autocomplete.search_handler, alias: users, acl_resource: oro_user_user_view }

    oro_user.gender_provider:
        class: %oro_user.gender_provider.class%
        arguments:
            - @translator

    oro_user.email.owner.provider:
        class: %oro_user.email.owner.provider.class%
        tags:
            - { name: oro_email.owner.provider, order: 1 }

    oro_user.change_password.subscriber:
        class: %oro_user.change_password.subscriber.class%
        arguments:
            - @form.factory
            - @security.context

    oro_user.handler.delete:
        class: %oro_user.handler.delete.class%
        parent: oro_soap.handler.delete.abstract
        calls:
            - [ setSecurityFacade, [@oro_security.security_facade] ]

    oro_user.role.handler.delete:
        class: %oro_user.role.handler.delete.class%
        parent: oro_soap.handler.delete.abstract
        arguments:
            - @oro_security.acl.sid_manager

    oro_user.activity_widget_provider:
        class: %oro_user.activity_widget_provider.class%
        arguments:
           - @oro_entity.entity_identifier_accessor
           - @oro_ui.twig.tab_extension
           - 'user_activity_tab_panel'
           - %oro_user.entity.class%
        tags:
           - { name: oro_activity.activity_widget_provider, priority: -10 }

    oro_user.event_listener.owner_user_grid_listener:
        class: %oro_user.event_listener.owner_user_grid_listener.class%
        arguments:
            - @doctrine.orm.entity_manager
            - @oro_entity_config.link.security_context
            - @oro_security.ownership_tree_provider
            - @?security.acl.voter.basic_permissions
        tags:
            - { name: kernel.event_listener, event: oro_datagrid.datagrid.build.before.owner-users-select-grid, method: onBuildBefore }
