Hi Clement,

According to your suggestion, i have successfully synced Groups and Users
seperately. Now if i use the javascript that you suggested :

                <dataset>
        <name>MemberData</name>
        <policy>FORCE</policy>
        <forceValues>
        <string>
        <![CDATA[js:
        var dnRoot = "dc=samsung,dc=com";
        var srcMembersNotFoundInDst = new Array();
        var dstMembers = new Array();
        var srcMembers = new Array();

                srcMembers = srcBean.getDatasetById("member").toArray() ;
                for (var i=0; i < srcMembers.length; i++ ) {
                        try {
                                var x =
srcLdap.attribute(srcMembers[i],'uid').get(0);

                                                
dstMembers.push(ldap.search("ou=Users","(uid="+x+")").get(0) + "," +
dnRoot)
                        }
                        catch (e) {
                                srcMembersNotFoundInDst.push( srcMembers[i]);
                        }
                }
                var jArr =
java.lang.reflect.Array.newInstance(java.lang.String,
dstMembers.length);
                for (var i = 0; i < dstMembers.length; i++)
                                { jArr[i] = dstMembers[i]; }
                jArr

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


Now i want to access this dataset "MemberData" (which should contain an
array of members within each Group with groupd_id i in DB) in the SQLMap,
what i want to do is for each member compare MemberData[j].uid with uid in
Users table, and get the corresponding user_id and fill in the user_group
table with user_id and group_id. How can i access this "MemberData" and
its uid in the SQLMap?



> 2014-10-20 13:50 GMT+02:00 <[email protected]>:
>
>> Hi Clement ,
>>
>> Thanks for the quick reply.
>> If i have 3 different tasks for user sync,group sync and the user_group
>> sync, that would work, but that does not satisfy the use-case that i am
>> aiming for. Is there no way in which I can do the following:
>>
>> 1)sync Groups, fetch its member attr, then for each of the members do an
>> ldap search in ou=Users and fetch its attributes?
>>
>
>
> Yes you can, with ScriptableJndiServices:
> http://lsc-project.org/javadoc/2.0-SNAPSHOT/org/lsc/jndi/ScriptableJndiServices.html
>
> For example; here is a code to map a source DN with a destination DN
> (attribute manager) :
>
>
>         <dataset>
>           <name>manager</name>
>           <policy>FORCE</policy>
>           <forceValues>
>             <string><![CDATA[js:
>                 var manager = srcBean.getDatasetFirstValueById("manager");
>                 var adManager;
>                 if ( manager.length() ) {
>                 try {
>                         var uid = srcLdap.attribute(manager,
> "uid").get(0);
>                         var res = ldap.list( "ou=users,ou=demo",
> "(sAMAccountName="+uid+")" ).get(0);
>                         adManager = res + "," +ldap.getContextDn();
>                 } catch (e) {};
>                 }
>                 adManager;
>             ]]></string>
>           </forceValues>
>        </dataset>
>
>
>
>
>> 2)I also understand that i will have to make some changes to the SqlMap
>> i
>> have constructed in this scenario(as it will no longer deal with just 1
>> table in this case).If there is a way to achieve 1) then what changes do
>> i
>> make to the SQLMAp?
>>
>>
>
> With 1) you will get an array of values for your dataset. I don't know how
> to use this array inside the sqlmap. We usually push only single values
> inside databases.
>
>
>
> Clément.
>


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

lsc-users mailing list
[email protected]
http://lists.lsc-project.org/listinfo/lsc-users

Reply via email to