2014-10-09 13:58 GMT+02:00 Antoine Gallavardin <
[email protected]>:
> Hello
>
> my LDAP source is a classical Tree with posixGroup used
> people is in ou=people
> people dn is cn=<my cn>, ou=people, dc=my,dc=dit
>
> groups in ou=groups with the uid in memberUid attribut
>
> I want to sync them in AD group
> I found example on LSC mailling list [1]
>
> But the problem is that I need to make an ldap request inside javascript
> for getting the CN used by en specifi uid
>
> code is like this pseudo code :
> // fetchj all memberer
> members=srcBean.getAttributeValuesById("memberUid").toArray();
> // for eache member ( which are memberUid)
> for each members {
> // get the corresponding CN
> CN=get_cn_of people_with_member[i]_as_uid
> // construct new DN
> memberDn = cn=CN + ou=groups+newDIT
> // add DN to to memberlist
> listMemberDn.push(memberDn);
> }
>
>
>
> The problem is :
>
> how to write get_cn_of people_with_member[i]_as_uid function ?
>
> Could I define a specific ldap request here (wich is could be
> independant of LSC bean ?)
>
>
Hi Antoine,
this is the goal of ldap and srcLdap helpers. They allows to request
detination LDAP or source LDAP.
See
http://lsc-project.org/javadoc/2.0-SNAPSHOT/org/lsc/jndi/ScriptableJndiServices.html
to know which methods you can call.
Here is a sample js code :
<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>
Clément.
_______________________________________________________________
Ldap Synchronization Connector (LSC) - http://lsc-project.org
lsc-users mailing list
[email protected]
http://lists.lsc-project.org/listinfo/lsc-users