AnsweredAssumed Answered

User database synchronization

Question asked by andrepra on Mar 27, 2009

months ago I wrote the classes to import users from a database. I wrote the PersonExportSource and I reimplemented the PersonService copying the one from the Alfresco source. The only difference is in the method getDefaultProperties() to manage the properties from external database in case of creation on demand (login time).
The procedure works fine but sometimes, I don't understand the reason, i got some users duplicated. I've tried to change the duplicate policies in the PersonService context file but I don't find the right configuration. My actual configuration is:

    <bean id="personService" class="" init-method="init">
        <property name="transactionService">
            <ref bean="transactionService" />
        <property name="nodeService">
            <ref bean="nodeService" />
        <property name="tenantService">
            <ref bean="tenantService"/>
        <property name="searchService">
            <ref bean="admSearchService" />
        <property name="permissionServiceSPI">
            <ref bean="permissionServiceImpl" />
        <property name="authorityService">
           <ref bean="authorityService" />
        <property name="dictionaryService">
           <ref bean="dictionaryService" />
        <property name="namespacePrefixResolver">
            <ref bean="namespaceService" />
        <property name="policyComponent">
            <ref bean="policyComponent"/>
        <property name="personCache">
            <ref bean="personCache" />
      <property name="personDao">
            <ref bean="personDaoImpl" />
        <!– Configurable properties.                                 –>
        <!–                                                          –>
        <!– TODO:                                                    –>
        <!– Add support for creating real home spaces adn setting    –>
        <!– permissions on the hame space and people created.        –>
        <!–                                                          –>
        <!– The store in which people are persisted.                 –>
        <property name="storeUrl">
        <!– Some authentication mechanisms may need to create people –>
        <!– in the repository on demand. This enables that feature.  –>
        <!– If dsiabled an error will be generated for missing       –>
        <!– people. If enabled then a person will be created and     –>
        <!– persisted.                                               –>
        <!– Valid values are                                         –>
        <!–     ${server.transaction.allow-writes}                   –>
        <!–     false                                                –>
        <property name="createMissingPeople">
        <property name="userNamesAreCaseSensitive">
        <!– New properties after 1.4.0 to deal with duplicate user ids when found –>
        <property name="processDuplicates">
        <!– one of:  LEAVE, SPLIT, DELETE –>
        <property name="duplicateMode">
        <property name="lastIsBest">
        <property name="includeAutoCreated">

I wrote a custom action that prune the user repository removing the duplicated users and leaving the last (same logic of PersonService).
I would like to understand if i'm the only that have this problem and how to configure the PersonService to avoid duplicates.