Thanks, it works during the add. But the update doesn't work, maybe I miss 
something:

<task>
        <name>All</name>
        <bean>org.lsc.beans.SimpleBean</bean>
        <ldapSourceService>
                <name>ad-source-all</name>
                <connection reference="ldap-source-conn" />
                <baseDn>DC=domain,DC=com</baseDn>
                <pivotAttributes>
                        <string>samAccountName</string>
                </pivotAttributes>
                <fetchedAttributes>
                        <string>samAccountName</string>
                </fetchedAttributes>
                
<getAllFilter><![CDATA[(&(objectClass=organizationalUnit)(OU=People))]]></getAllFilter>
                
<getOneFilter><![CDATA[(&(objectClass=organizationalUnit)(OU=People))]]></getOneFilter>
        </ldapSourceService>

        <ldapDestinationService>
                <name>openldap-dst-all</name>
                <connection reference="ldap-dst-conn" />

                <baseDn>DC=domain,DC=com</baseDn>

                <pivotAttributes>
                        <string>uniqueMember</string>
                </pivotAttributes>

                <fetchedAttributes>
                        <string>uniqueMember</string>
                        <string>objectClass</string>
                </fetchedAttributes>

                <getAllFilter>(objectClass=groupOfUniqueNames)</getAllFilter>
                
<getOneFilter><![CDATA[(&(objectClass=groupOfUniqueNames)(cn=All))]]></getOneFilter>
        </ldapDestinationService>

        <propertiesBasedSyncOptions>
                
<mainIdentifier>"cn=All,ou=groups,DC=domain,DC=com"</mainIdentifier>
                <defaultDelimiter>;</defaultDelimiter>
                <defaultPolicy>FORCE</defaultPolicy>

                <conditions>
                        <create>true</create>
                        <update>true</update>
                        <delete>false</delete>
                        <changeId>false</changeId>
                </conditions>

                <dataset>
                        <name>objectclass</name>
                        <policy>KEEP</policy>
                        <createValues>
                                <string>"groupOfUniqueNames"</string>
                                <string>"top"</string>
                  </createValues>
                </dataset>

                <dataset>
                        <name>uniqueMember</name>
                        <policy>FORCE</policy>
                        <forceValues>
                                <string>
                                <![CDATA[rjs:

                                        var membersDstDn = new 
java.util.ArrayList();

                                        try
                                        {
                                                var users = 
srcLdap.search("ou=people","(&(objectCategory=person)(sAMAccountName=*))");
                                        }
                                        catch(e)
                                        {

                                        }

                                        for  (var i=0; i<users.size(); i++)
                                        {
                                                try
                                                {
                                                        var sam = 
srcLdap.attribute(users.get(i), "samAccountName").get(0);
                                                        var destDn = 
ldap.search("ou=people","(uid="+ sam +")");
                                                }
                                                catch(e) {
                                                        continue;
                                                }

                                                if (destDn.size() == 0 || 
destDn.size() > 1)
                                                {
                                                        continue;
                                                }

                                                var destMemberDn = 
destDn.get(0) + "," + ldap.getContextDn();

                                                membersDstDn.add(destMemberDn);
                                        }

                                        membersDstDn

                                        ]]>
                                </string>
                        </forceValues>
                </dataset>

        </propertiesBasedSyncOptions>
</task>


‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Wednesday 17 October 2018 15:43, Clément OUDOT <[email protected]> 
wrote:

> Le 17/10/2018 à 14:52, twikk a écrit :
>
> > Hello,
> > The JS in the dataset is not really a problem to implement, but the source 
> > logic is (each entry found is mapped and I don't want that in this specific 
> > case).
> > Maybe I don't understand well the process but how can find the objects in 
> > the source and force the destination attributes/objects to be only executed 
> > through JS and not the default logic (each entry mapped, etc.).
>
> You must map entries, but you can have only one entry in source, which
> is the "ou=xxx" branch, by configuring search base and filter.
>
> For example:
>
> <baseDn>ou=xxx,dc=example,dc=com</baseDn>
> <getAllFilter><![CDATA[(&(objectClass=organizationalUnit)(ou=xxx))]]></getAllFilter>
>
> Then use javascript with "srcLdap" to get all values you want to put in
> destination.
>
> ---------------------------------------------------------------------------------------
>
> Clément Oudot | Identity Solutions Manager
>
> [email protected]
>
> Worteks | https://www.worteks.com
>
> Ldap Synchronization Connector (LSC) - http://lsc-project.org
>
> lsc-users mailing list
> [email protected]
> https://lists.lsc-project.org/cgi-bin/mailman/listinfo/lsc-users


_______________________________________________________________
Ldap Synchronization Connector (LSC) - http://lsc-project.org

lsc-users mailing list
[email protected]
https://lists.lsc-project.org/cgi-bin/mailman/listinfo/lsc-users

Reply via email to