Unfortunately I dont get it to work, any chance to make this part a bit
more communicative?

                var membersSrcDn =
srcBean.getDatasetValuesById("uniqueMember");                var
membersDstDn = [];                for  (var i=0;
i<membersSrcDn.size(); i++) {                        var memberSrcDn =
membersSrcDn.get(i);                        var uid = "";
          try {                                uid =
srcLdap.attribute(memberSrcDn, "uid").get(0);                        }
catch(e) {                                continue;
    }                        var destDn =
ldap.search("ou=users,ou=demo", "(sAMAccountName=" + uid + ")");
                 if (destDn.size() == 0 || destDn.size() > 1) {
                        continue;                        }
           var destMemberDn = destDn.get(0) + "," +
ldap.getContextDn();
membersDstDn.push(destMemberDn);                }
membersDstDn

e.g. add print to console statement to see what is going on:


print(membersSrcDn)
or print the result of ldap.search(...)
print(destDn)


Am Mi., 6. Nov. 2019 um 23:45 Uhr schrieb Clément OUDOT <
clement.ou...@worteks.com>:

>
> Le 06/11/2019 à 19:00, Marian Thieme a écrit :
>
> Hello,
>
> in the tutorial:
> there is mentioned the some javascript in order to fetch the users in the
> destination directory. I am trying to get this code adapted to my needs. I
> have question regarding the line:
>
>  var destDn = ldap.search("ou=users,ou=demo", "(sAMAccountName=" + uid + ")");
>
>
> How is the search function specified? What are the arguments?
>
> RIght now I've organized users in the destination dir (AD) like this:
>
> dc: CN=User Name,OU=People,DC=example,DC=org
> ...
> objectClass: person
> cn: User Name
> sAMAccountName=marian.thieme
> uid=u12345
> ...
>
> I tried to lookup users in the AD like this:ldap.search("ou=people", "(uid=" 
> + uid + ")");
>
> But I am unsure about the 2 arguments I've to provide to ldap.search()
>
> I can see from DEBUG logs that e.g. user dn:  
> uid=u12345,ou=people,dc=ldap,dc=example,dc=net does exist in the source 
> directory.
>
> Since I have uid in the destination dir as well, I asume I can use the uid to 
> lookup the user.
>
>
> However, a valid ldap query to retrieve the user "CN=User Name" with uid 
> u12345 from AD would be something like:
> ldapsearch -b ou=people,$OBJECT_DN "(&(objectclass=person)(uid=u12345))"
>
>
> Hello,
>
> you can find some information here:
> https://lsc-project.org/javadoc/2.1-SNAPSHOT/org/lsc/jndi/ScriptableJndiServices.html
>
> Note that search method returns an array, you have to take the first
> element to get the DN. And the value of the base parameter is concatened to
> the context set un LDAP URL at the connection level, so remove the context
> of the base value to avoid an error.
>
> --
> Clément Oudot | Identity Solutions Manager
> clement.ou...@worteks.com
>
> Worteks | https://www.worteks.com
>
> _______________________________________________________________
> Ldap Synchronization Connector (LSC) - http://lsc-project.org
>
> lsc-users mailing list
> lsc-users@lists.lsc-project.org
> https://lists.lsc-project.org/cgi-bin/mailman/listinfo/lsc-users
_______________________________________________________________
Ldap Synchronization Connector (LSC) - http://lsc-project.org

lsc-users mailing list
lsc-users@lists.lsc-project.org
https://lists.lsc-project.org/cgi-bin/mailman/listinfo/lsc-users

Reply via email to