parameters:
    oro_security.security_facade.class:                        Oro\Bundle\SecurityBundle\SecurityFacade

    oro_security.acl.manager.class:                            Oro\Bundle\SecurityBundle\Acl\Persistence\AclManager
    oro_security.acl.sid_manager.class:                        Oro\Bundle\SecurityBundle\Acl\Persistence\AclSidManager
    oro_security.acl.ace_provider.class:                       Oro\Bundle\SecurityBundle\Acl\Persistence\AceManipulationHelper
    oro_security.acl.privilege_repository.class:               Oro\Bundle\SecurityBundle\Acl\Persistence\AclPrivilegeRepository
    oro_security.acl.extension_selector.class:                 Oro\Bundle\SecurityBundle\Acl\Extension\AclExtensionSelector
    oro_security.acl.extension.entity.class:                   Oro\Bundle\SecurityBundle\Acl\Extension\EntityAclExtension
    oro_security.acl.extension.action.class:                   Oro\Bundle\SecurityBundle\Acl\Extension\ActionAclExtension
    oro_security.acl.voter.class:                              Oro\Bundle\SecurityBundle\Acl\Voter\AclVoter
    oro_security.acl.provider.class:                           Oro\Bundle\SecurityBundle\Acl\Domain\RootBasedAclProvider
    oro_security.acl.dbal.provider.class:                      Oro\Bundle\SecurityBundle\Acl\Dbal\MutableAclProvider
    oro_security.acl.permission_granting_strategy.class:       Oro\Bundle\SecurityBundle\Acl\Domain\PermissionGrantingStrategy
    oro_security.acl.permission_map.class:                     Oro\Bundle\SecurityBundle\Acl\Permission\PermissionMap
    oro_security.acl.object_identity_factory.class:            Oro\Bundle\SecurityBundle\Acl\Domain\ObjectIdentityFactory
    oro_security.acl.object_identity_retrieval_strategy.class: Oro\Bundle\SecurityBundle\Acl\Domain\ObjectIdentityRetrievalStrategy
    oro_security.acl.object_id_accessor.class:                 Oro\Bundle\SecurityBundle\Acl\Domain\ObjectIdAccessor

    oro_security.owner.tree.class:                             Oro\Bundle\SecurityBundle\Owner\OwnerTree
    oro_security.owner.decision_maker.class:                   Oro\Bundle\SecurityBundle\Owner\EntityOwnershipDecisionMaker

    oro_security.type.oro_acl_access_level_selector.class:     Oro\Bundle\SecurityBundle\Form\Type\AclAccessLevelSelectorType
    oro_security.type.oro_acl_label.class:                     Oro\Bundle\SecurityBundle\Form\Type\ObjectLabelType

    oro_security.entity_security_metadata_provider.class:      Oro\Bundle\SecurityBundle\Metadata\EntitySecurityMetadataProvider
    oro_security.action_metadata_provider.class:               Oro\Bundle\SecurityBundle\Metadata\ActionMetadataProvider

    oro_security.acl.annotation_provider.class:                Oro\Bundle\SecurityBundle\Metadata\AclAnnotationProvider
    oro_security.acl.annotation_loader.class:                  Oro\Bundle\SecurityBundle\Annotation\Loader\AclAnnotationLoader
    oro_security.acl.config_loader.class:                      Oro\Bundle\SecurityBundle\Annotation\Loader\AclConfigLoader

    oro_security.entity_security_config_subscriber.class:      Oro\Bundle\SecurityBundle\EventListener\EntitySecurityMetadataConfigSubscriber
    oro_security.acl.annotation_provider.cache.warmer.class:   Oro\Bundle\SecurityBundle\Cache\AclAnnotationCacheWarmer
    oro_security.acl.annotation_provider.cache.clearer.class:  Oro\Bundle\SecurityBundle\Cache\AclAnnotationCacheClearer
    oro_security.action_metadata_provider.cache.warmer.class:  Oro\Bundle\SecurityBundle\Cache\ActionMetadataCacheWarmer
    oro_security.action_metadata_provider.cache.clearer.class: Oro\Bundle\SecurityBundle\Cache\ActionMetadataCacheClearer
    oro_security.entity_security_metadata_provider.cache.warmer.class:  Oro\Bundle\SecurityBundle\Cache\EntitySecurityMetadataCacheWarmer
    oro_security.entity_security_metadata_provider.cache.clearer.class: Oro\Bundle\SecurityBundle\Cache\EntitySecurityMetadataCacheClearer

    oro_security.listener.controller.class:                    Oro\Bundle\SecurityBundle\EventListener\ControllerListener

    oro_security.twig.security_extension:                      Oro\Bundle\SecurityBundle\Twig\OroSecurityExtension
    oro_security.twig.security_organization_extension:         Oro\Bundle\SecurityBundle\Twig\OroSecurityOrganizationExtension

    oro_security.encoder.mcrypt.class:                         Oro\Bundle\SecurityBundle\Encoder\Mcrypt

    oro_security.acl_helper.class:                             Oro\Bundle\SecurityBundle\ORM\Walker\AclHelper
    oro_security.orm.ownership_sql_walker_builder.class:       Oro\Bundle\SecurityBundle\ORM\Walker\OwnershipConditionDataBuilder
    oro_security.ownership_tree_provider.class:                Oro\Bundle\SecurityBundle\Owner\OwnerTreeProvider
    oro_security.ownership_tree.cache.warmer.class:            Oro\Bundle\SecurityBundle\Cache\OwnerTreeCacheWarmer
    oro_security.ownership_tree.cache.clearer.class:           Oro\Bundle\SecurityBundle\Cache\OwnerTreeCacheCleaner
    oro_security.ownership_tree_subscriber.class:              Oro\Bundle\SecurityBundle\EventListener\OwnerTreeListener
    oro-security.authentication.listener.basic.class:          Oro\Bundle\SecurityBundle\Http\Firewall\OrganizationBasicAuthenticationListener
    oro_security.authentication.provider.username_password_organization.class: Oro\Bundle\SecurityBundle\Authentication\Provider\UsernamePasswordOrganizationAuthenticationProvider
    oro_security.authentication.provider.organization_rememberme.class: Oro\Bundle\SecurityBundle\Authentication\Provider\OrganizationRememberMeAuthenticationProvider

    oro_security.listener.context_listener.class:              Oro\Bundle\SecurityBundle\Http\Firewall\ContextListener
    oro_security.listener.refresh_context_listener.class:      Oro\Bundle\SecurityBundle\EventListener\RefreshContextListener
    oro_security.listener.api_listener.class:                  Oro\Bundle\SecurityBundle\EventListener\ApiEventListener
    oro_security.listener.search_listener.class:               Oro\Bundle\SecurityBundle\EventListener\SearchListener
    oro_security.listener.console_context_listener.class:      Oro\Bundle\SecurityBundle\EventListener\ConsoleContextListener

    oro_security.form.extension.aclprotected_type.class:       Oro\Bundle\SecurityBundle\Form\Extension\AclProtectedTypeExtension

services:
    oro_security.security_facade:
        class: %oro_security.security_facade.class%
        arguments:
            - @security.context
            - @oro_security.acl.annotation_provider
            - @oro_security.acl.object_identity_factory
            - @oro_entity.orm.entity_class_resolver
            - @logger
        tags:
            - { name: monolog.logger, channel: security }
        lazy: true

    security.context.link:
        tags:
            - { name: oro_service_link,  service: security.context }

    oro_security.security_facade.link:
        tags:
            - { name: oro_service_link,  service: oro_security.security_facade }

    oro_security.acl.manager:
        class: %oro_security.acl.manager.class%
        arguments:
            - @oro_security.acl.object_identity_factory
            - @oro_security.acl.extension_selector
            - @?security.acl.dbal.provider
            - @oro_security.acl.ace_provider
        lazy: true

    oro_security.acl.privilege_repository:
        class: %oro_security.acl.privilege_repository.class%
        arguments:
            - @oro_security.acl.manager
            - @translator

    oro_security.acl.sid_manager:
        class: %oro_security.acl.sid_manager.class%
        arguments:
            - @?security.acl.dbal.provider

    oro_security.link.sid_manager:
        tags:
            - { name: oro_service_link,  service: oro_security.acl.sid_manager }

    security.acl.cache.doctrine.cache_impl:
        public: false
        parent: oro.cache.abstract
        calls:
            - [ setNamespace, [ "oro_acl" ] ]

    oro_security.acl.ace_provider:
        public: false
        class: %oro_security.acl.ace_provider.class%

    oro_security.acl.extension_selector:
        public: false
        class: %oro_security.acl.extension_selector.class%
        arguments:
            - @oro_security.acl.object_id_accessor

    oro_security.acl.extension.entity:
        public: false
        class: %oro_security.acl.extension.entity.class%
        arguments:
            - @oro_security.acl.object_id_accessor
            - @oro_entity.orm.entity_class_resolver
            - @oro_security.entity_security_metadata_provider
            - @oro_security.owner.ownership_metadata_provider
            - @oro_security.owner.decision_maker
        tags:
            - { name: oro_security.acl.extension, priority: 20 }

    oro_security.acl.extension.action:
        public: false
        class: %oro_security.acl.extension.action.class%
        arguments:
            - @oro_security.action_metadata_provider
        tags:
            - { name: oro_security.acl.extension, priority: 10 }

    oro_security.acl.provider:
        public: false
        class: %oro_security.acl.provider.class%
        arguments:
            - @oro_security.acl.object_identity_factory

    oro_security.acl.voter_link:
        tags:
            - { name: oro_service_link,  service: ?security.acl.voter.basic_permissions }

    oro_security.acl.permission_granting_strategy:
        public: false
        class: %oro_security.acl.permission_granting_strategy.class%
        calls:
             - [setAuditLogger, [@?security.acl.audit_logger]]

    oro_security.acl.permission_map:
        public: false
        class: %oro_security.acl.permission_map.class%
        arguments:
            - @oro_security.acl.extension_selector

    oro_security.acl.object_identity_factory:
        class: %oro_security.acl.object_identity_factory.class%
        arguments:
            - @oro_security.acl.extension_selector

    oro_security.acl.object_identity_retrieval_strategy:
        public: false
        class: %oro_security.acl.object_identity_retrieval_strategy.class%
        arguments:
            - @oro_security.acl.object_identity_factory

    oro_security.acl.object_id_accessor:
        public: false
        class: %oro_security.acl.object_id_accessor.class%

    oro_security.owner.tree:
        public: false
        class: %oro_security.owner.tree.class%

    oro_security.owner.decision_maker:
        public: false
        class: %oro_security.owner.decision_maker.class%
        arguments:
            - @oro_security.ownership_tree_provider
            - @oro_security.acl.object_id_accessor
            - @oro_security.owner.entity_owner_accessor
            - @oro_security.owner.ownership_metadata_provider

    oro_security.form.type.oro_acl_access_level_selector:
        class: %oro_security.type.oro_acl_access_level_selector.class%
        tags:
            - { name: form.type, alias: oro_acl_access_level_selector }

    oro_security.form.type.object_label_type:
        class: %oro_security.type.oro_acl_label.class%
        tags:
            - { name: form.type, alias: oro_acl_label }

    oro_security.entity_security_metadata_provider:
        public: false
        class: %oro_security.entity_security_metadata_provider.class%
        arguments:
            - @oro_entity_config.provider.security
            - @oro_entity_config.provider.entity
            - @oro_entity_config.provider.extend
            - @oro_security.entity_security_metadata_provider.cache

    oro_security.entity_security_metadata_provider.cache:
        public: false
        parent: oro.cache.abstract
        calls:
            - [ setNamespace, [ "oro_acl_entities.cache" ] ]

    oro_security.action_metadata_provider:
        public: false
        class: %oro_security.action_metadata_provider.class%
        arguments:
            - @oro_security.acl.annotation_provider
            - @oro_security.action_metadata_provider.cache

    oro_security.action_metadata_provider.cache:
        public: false
        parent: oro.file_cache.abstract
        calls:
            - [ setNamespace, [ "oro_acl_actions.cache" ] ]

    oro_security.acl.annotation_provider:
        class: %oro_security.acl.annotation_provider.class%
        arguments:
          - @oro_security.acl.annotation_provider.cache

    oro_security.acl.annotation_provider.cache:
        public: false
        parent: oro.file_cache.abstract
        calls:
            - [ setNamespace, [ "oro_acl_annotations.cache" ] ]

    oro_security.acl.annotation_loader:
        public: false
        class: %oro_security.acl.annotation_loader.class%
        arguments:
            - @annotation_reader
        tags:
            - { name: oro_security.acl.config_loader }

    oro_security.acl.config_loader:
        public: false
        class: %oro_security.acl.config_loader.class%
        tags:
            - { name: oro_security.acl.config_loader }

    oro_security.entity_security_config_subscriber:
        class: %oro_security.entity_security_config_subscriber.class%
        arguments:
            - @oro_security.entity_security_metadata_provider
        tags:
            - { name: kernel.event_subscriber }

    oro_security.acl.annotation_provider.cache.warmer:
        public: false
        class: %oro_security.acl.annotation_provider.cache.warmer.class%
        arguments:
            - @oro_security.acl.annotation_provider
        tags:
            - { name: kernel.cache_warmer, priority: 5 }

    oro_security.acl.annotation_provider.cache.clearer:
        public: false
        class: %oro_security.acl.annotation_provider.cache.clearer.class%
        arguments:
            - @oro_security.acl.annotation_provider
        tags:
            - { name: kernel.cache_clearer }

    oro_security.action_metadata_provider.cache.warmer:
        public: false
        class: %oro_security.action_metadata_provider.cache.warmer.class%
        arguments:
            - @oro_security.action_metadata_provider
        tags:
            - { name: kernel.cache_warmer, priority: 4 }

    oro_security.action_metadata_provider.cache.clearer:
        public: false
        class: %oro_security.action_metadata_provider.cache.clearer.class%
        arguments:
            - @oro_security.action_metadata_provider
        tags:
            - { name: kernel.cache_clearer }

    oro_security.entity_security_metadata_provider.cache.warmer:
        public: false
        class: %oro_security.entity_security_metadata_provider.cache.warmer.class%
        arguments:
            - @oro_security.entity_security_metadata_provider
        tags:
            - { name: kernel.cache_warmer }

    oro_security.entity_security_metadata_provider.cache.clearer:
        public: false
        class: %oro_security.entity_security_metadata_provider.cache.clearer.class%
        arguments:
            - @oro_security.entity_security_metadata_provider
        tags:
            - { name: kernel.cache_clearer }

    oro_security.listener.controller:
        class: %oro_security.listener.controller.class%
        arguments:
            - @oro_security.security_facade
            - @logger
        tags:
            - { name: kernel.event_listener, event: kernel.controller, method: onKernelController, priority: -1 }
            - { name: monolog.logger, channel: security }

    oro_security.twig.security_extension:
        class: %oro_security.twig.security_extension%
        arguments:
            - @oro_security.security_facade
        tags:
            - { name: twig.extension }

    oro_security.twig.security_organization_extension:
        class: %oro_security.twig.security_organization_extension%
        arguments:
            - @security.context
        tags:
            - { name: twig.extension }

    oro_security.encoder.mcrypt:
        class: %oro_security.encoder.mcrypt.class%
        arguments: [ %kernel.secret% ]

    oro_security.acl_helper:
        class: %oro_security.acl_helper.class%
        arguments:
             - @oro_security.orm.ownership_sql_walker_builder

    oro_security.orm.ownership_sql_walker_builder:
        public: false
        class: %oro_security.orm.ownership_sql_walker_builder.class%
        arguments:
            - @oro_entity_config.link.security_context
            - @oro_security.acl.object_id_accessor
            - @oro_security.entity_security_metadata_provider
            - @oro_security.owner.ownership_metadata_provider
            - @oro_security.ownership_tree_provider
            - @?security.acl.voter.basic_permissions

    oro_security.ownership_tree_provider:
        public: false
        class: %oro_security.ownership_tree_provider.class%
        arguments:
            - @doctrine.orm.entity_manager
            - @oro_security.ownership_tree_provider.cache

    oro_security.link.ownership_tree_provider:
        tags:
            - { name: oro_service_link,  service: oro_security.ownership_tree_provider }

    oro_security.ownership_tree_provider.cache:
        public: false
        parent: oro.cache.abstract
        calls:
            - [ setNamespace, [ "oro_acl_owner_tree.cache" ] ]

    oro_security.ownership_tree.cache.warmer:
        public: false
        class: %oro_security.ownership_tree.cache.warmer.class%
        arguments:
            - @oro_security.ownership_tree_provider
        tags:
            - { name: kernel.cache_warmer }

    oro_security.ownership_tree.cache.cleaner:
        public: false
        class: %oro_security.ownership_tree.cache.clearer.class%
        arguments:
            - @oro_security.ownership_tree_provider
        tags:
            - { name: kernel.cache_clearer }

    oro_security.ownership_tree_subscriber:
        class: %oro_security.ownership_tree_subscriber.class%
        arguments:
            - @oro_security.link.ownership_tree_provider
        tags:
            - { name: doctrine.event_listener, event: onFlush }

    oro_security.authentication.listener.basic:
        class: %oro-security.authentication.listener.basic.class%
        arguments:
            - @security.context
            - @security.authentication.manager
            - null
            - null
            - @oro_organization.organization_manager
            - @?logger
        public: false
        abstract: true

    oro_security.authentication.provider.username_password_organization:
        class: %oro_security.authentication.provider.username_password_organization.class%
        arguments:
            - null
            - @security.user_checker
            - null
            - @security.encoder_factory
            - %security.authentication.hide_user_not_found%
        abstract: true
        public: false

    oro_security.authentication.provider.organization_rememberme:
        class: %oro_security.authentication.provider.organization_rememberme.class%
        arguments:
            - @security.user_checker
        abstract: true
        public: false

    oro_security.listener.context_listener:
        class: %oro_security.listener.context_listener.class%
        arguments:
            - @security.context
            - @oro_organization.organization_manager
        tags:
            - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest }

    oro_security.listener.api_listener:
          class: %oro_security.listener.api_listener.class%
          arguments:
              - @oro_security.security_facade
              - @oro_security.acl_helper
          calls:
              - [setRequest, [@?request=]]
          tags:
              - { name: kernel.event_listener, event: oro_api.request.get_list.before, method: onGetListBefore }
              - { name: kernel.event_listener, event: oro_api.request.find.after, method: onFindAfter }

    oro_security.listener.refresh_context_listener:
        class: %oro_security.listener.refresh_context_listener.class%
        arguments:
            - @security.context.link
            - @doctrine
            - @oro_entity.doctrine_helper
        tags:
            - { name: doctrine.event_listener, event: onClear }

    oro_security.listener.console_context_listener:
        class: %oro_security.listener.console_context_listener.class%
        arguments:
            - @doctrine
            - @security.context
            - @oro_user.manager
        tags:
            - { name: kernel.event_listener, event: console.command, method: onConsoleCommand }

    oro_security.form.extension.aclprotected_type:
        class: %oro_security.form.extension.aclprotected_type.class%
        arguments:
            - @oro_security.acl_helper
        tags:
            - { name: form.type_extension, alias: entity }

    oro_security.listener.search_listener:
          class: %oro_security.listener.search_listener.class%
          arguments:
              - @oro_security.owner.ownership_metadata_provider
              - @oro_security.security_facade
          tags:
              - { name: kernel.event_listener, event: oro_search.prepare_entity_map, method: prepareEntityMapEvent, priority: 100 }
              - { name: kernel.event_listener, event: oro_search.before_search, method: beforeSearchEvent }
