Le 06/09/2018 à 15:00, Matjaz Premerl a écrit :
> Hi,
>
> Last days I'm playing around with the LSC tool with the defined sample
> folder. What about the information for username which is mandatory to
> have e.g. samAccountName in Active Directory. This information is not
> nornally generated in some HR application. Is there any known approach
> how to do this properly using LSC, to properly avoid conflicts with
> e.g. existing user like "johnsmith", how and where in the process I
> need to achieve e.g. "johnsmith1", etc.
>

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;
}

That can be called in lsc.xml:

        <mainIdentifier>js:"uid=" + getUid(ldap,
srcBean.getDatasetFirstValueById("FIRSTNAME"),
srcBean.getDatasetFirstValueById("LASTNAME"),
srcBean.getDatasetFirstValueById("EMPLOYEEID")) +
",ou=users,dc=example,dc=com"</mainIdentifier>



See also https://lsc-project.org/documentation/latest/scripting/start

-- 
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

Reply via email to