Issue #734 has been updated by Frédéric POISSON.
To better understand i have made a little test where i create a function for
description attribute. Inside this function i have copy a part of the
mainIdentifier function i whish to use.
On my source LDAP server i have an entry which contain the seeAlso and
roleOccupant informations that i use to create the main identifier.
So my function for description attribute will have to return the DN of the
destination entry.
Here is the entries :
<pre>
dn: cn=List_HR,ou=lsc,dc=example,dc=com
seeAlso: ou=PeopleHR,dc=example,dc=com
roleOccupant: ou=HumanRessource,dc=foo,dc=bar
</pre>
An entry on source LDAP server :
<pre>dn: uid=elpida.duplaquet,ou=PeopleHR,dc=example,dc=com</pre>
And the wanted destination entry :
<pre>dn: uid=elpida.duplaquet,ou=HumanRessource,dc=foo,dc=bar</pre>
I made a test with a function for attribute description defined like this
inside lsc.xml :
<pre>
<dataset>
<name>description</name>
<policy>FORCE</policy>
<forceValues>
<string>js:descriptionDataset(srcLdap)</string>
</forceValues>
</dataset>
<dataset>
</pre>
The Javascript function do :
<pre>
function descriptionDataset()
{
var dn = "" + srcBean.getMainIdentifier().slice(0);
var base = dn.replace(/[^,]*,\s*/i,'');
var main = null;
try {
main = "CN="
+ srcBean.getDatasetFirstValueById("cn").trim()
+ ","
+ srcLdap.attribute(srcLdap.search("ou=lsc",
"(seeAlso=" + base + ")").get(0), "description" ).get(0);
java.lang.System.out.println("description first: " + main);
} catch(e) {
java.lang.System.out.println("Error: " + e);
main = srcBean.getMainIdentifier();
}
java.lang.System.out.println("description last: " + main);
return main;
}
</pre>
If i run LSC i have these errors :
<pre>
Nov 14 09:14:37 - ERROR - Fail to compute expression:
descriptionDataset(srcLdap) on
id=uid=elpida.duplaquet,ou=PeopleHR,dc=example,dc=com
Reason: javax.script.ScriptException:
sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "srcLdap" is not
defined. (<Unknown source>#3) in <Unknown source> at line number 3
Nov 14 09:14:37 - ERROR - Error while synchronizing ID {uid=elpida.duplaquet}:
org.lsc.exception.LscServiceException: javax.script.ScriptException:
sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "srcLdap" is not
defined. (<Unknown source>#3) in <Unknown source> at line number 3
</pre>
If i remove the srcLdap argument inside lsc.xml i have that as behavior :
<pre>
Nov 14 09:00:56 - INFO - Starting sync for Users
Error: ReferenceError: "srcLdap" is not defined.
description last: uid=elpida.duplaquet,ou=PeopleHR,dc=example,dc=com
Nov 14 09:00:57 - INFO - # Adding new object
uid=elpida.duplaquet,ou=HumanRessource,dc=foo,dc=bar for Users
# Fri Nov 14 09:00:57 CET 2014
dn: uid=elpida.duplaquet,ou=HumanRessource,dc=foo,dc=bar
changetype: add
uid: elpida.duplaquet
sn: duplaquet
cn: duplaquet elpida
description: uid=elpida.duplaquet,ou=PeopleHR,dc=example,dc=com
givenname: elpida
objectClass: person
objectClass: inetOrgPerson
objectClass: top
</pre>
So when description dataset is calling function descriptionDataset() i have a
"srcLdap" is not defined, and my try/catch return only
srcBean.getMainIdentifier() for attribute description and not the destination
dn.
Tell me if i give sufficient information or not.
----------------------------------------
Bug #734: External Javascript file do not load srcLdap
http://tools.lsc-project.org/issues/734
Author: Frédéric POISSON
Status: Assigned
Priority: Normal
Assigned to: Raphaël Ouazana
Category: Core
Target version: 2.1.2
Problem in version: 2.1.1
Hello,
While i'm trying to run LSC with an external JavaScript file defined with
scriptInclude, i use a function with srcLdap object. But i have a
<pre>"srcLdap" is not defined.</pre> error and my JavaScript code do not run
correctly. If i try to give the srcLdap as an argument of my function i have
the error <pre>ReferenceError: "srcLdap" is not defined.</pre>, but if i put
the code of the function inside lsc.xml file and the dataset, all is running
fine.
Could you tell me if srcLdap and ldap from org.lsc.jndi.ScriptableJndiServices
are available with LSC 2.1.1 ? And how to use them ?
Thanks,
Regards
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://tools.lsc-project.org/my/account
_______________________________________________________________
Ldap Synchronization Connector (LSC) - http://lsc-project.org
lsc-dev mailing list
[email protected]
http://lists.lsc-project.org/listinfo/lsc-dev