<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>
    <!--
        Job definition to import people and groups from one or more external user registries in the authentication chain
        (e.g. LDAP directory)
    -->

    <bean id="syncTrigger" class="org.alfresco.util.CronTriggerBean">
        <property name="jobDetail">
            <bean id="ldapPeopleJobDetail" class="org.springframework.scheduling.quartz.JobDetailBean">
                <property name="jobClass">
                    <value>org.alfresco.repo.security.sync.UserRegistrySynchronizerJob</value>
                </property>
                <property name="jobDataAsMap">
                    <map>
                        <entry key="userRegistrySynchronizer">
                            <ref bean="userRegistrySynchronizer" />
                        </entry>
                        <entry key="synchronizeChangesOnly">
                            <value>${synchronization.synchronizeChangesOnly}</value>
                        </entry>
                    </map>
                </property>
            </bean>
        </property>
        <property name="cronExpression">
            <value>${synchronization.import.cron}</value>
        </property>
        <property name="scheduler">
            <ref bean="schedulerFactory" />
        </property>
    </bean>

    <!-- The chaining user registry synchronizer -->
    <bean id="userRegistrySynchronizer" class="org.alfresco.repo.security.sync.ChainingUserRegistrySynchronizer">
        <property name="syncWhenMissingPeopleLogIn">
            <value>${synchronization.syncWhenMissingPeopleLogIn}</value>
        </property>
        <property name="syncOnStartup">
            <value>${synchronization.syncOnStartup}</value>
        </property>
        <property name="autoCreatePeopleOnLogin">
            <value>${synchronization.autoCreatePeopleOnLogin}</value>
        </property>
        <property name="authorityService">
            <ref bean="authorityService" />
        </property>
        <property name="personService">
            <ref bean="personService" />
        </property>
        <property name="attributeService">
            <ref bean="attributeService" />
        </property>
        <property name="applicationContextManager">
            <ref bean="Authentication" />
        </property>
        <property name="transactionService">
            <ref bean="transactionService" />
        </property>
        <property name="ruleService">
            <ref bean="ruleService" />
        </property>
        <property name="jobLockService">
            <ref bean="jobLockService" />
        </property>
        <property name="sourceBeanName">
            <value>userRegistry</value>
        </property>
        <property name="loggingInterval">
            <value>${synchronization.loggingInterval}</value>
        </property>
        <property name="workerThreads">
            <value>${synchronization.workerThreads}</value>
        </property>
    </bean>


</beans>