Am Donnerstag, 06. September 2018 15:20 CEST, Clément OUDOT 
<[email protected]> schrieb: 
  
> Good question. You can write some javascript that will search on
> destination LDAP if the login already exists, and adapt it.
> 
> 
> Code example:
> 
> function getUid(dstLdap, firstname, lastname, employeeid) {
> 
>     var uid = "";
>     var uidTest = "";
> 
>     firstname = normalizeString(firstname).toLowerCase();
>     lastname = normalizeString(lastname).toLowerCase();
> 
> 
>         for ( var i = 0; i < firstname.length(); i++ ){
>              uidTest = lastname + firstname.substr(0,i+1);
>              if (
> dstLdap.search("ou=users","(&(!(employeeNumber="+employeeid+"))(uid="+uidTest+"))"
> ) == "[]" ) {
>                  uid = uidTest;
>                  break;
>              }
>         }
> 
>     return uid;
> }

Just to mention it: the above code does have a potential race condition. 
Unlikely to happen, but
needs to be aware of it.

 Cheers, RalfD


_______________________________________________________________
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