For information
description is an ldap multivalued attribute tha can contain values like
{LEAVINGDATE}xxxxxxxx
It’s seem to hang to first value of Array « description » .
--
Pour toute demande de support informatique :
[email protected]<mailto:[email protected]>
Pour une assistance à distance : cliquez ici<http://get.teamviewer.com/ak6yycv>
---
Vincent Lepetit
Administrateur Systèmes, Réseaux et Télécom
Tel : +33 176 218 318
Mob : +33 634 422 573
Paris Sciences et Lettres
60 rue mazarine
Paris, 75006
http://www.univ-psl.fr
Le 5 févr. 2018 à 13:47, Vincent LEPETIT
<[email protected]<mailto:[email protected]>> a écrit :
Cet expéditeur n’a pas passé les vérifications relatives à la détection des
fraudes et n’est peut-être pas la personne qu’il prétend être. En savoir plus
sur l’ usurpation d’identités<http://aka.ms/LearnAboutSpoofing>
Votre avis<http://aka.ms/SafetyTipsFeedback>
Ok me to.
Now my code is like this :
function grep_leavingdate (description)
{
var patterndepart = /{LEAVINGDATE}(.*)/;
var trouve = description.match(patterndepart);
if (trouve !== null ) return trouve[1];
}
function return_maxleavingdate(description)
{
var descriptionfiltreDatesDeparts = description.filter (grep_leavingdate);
var DatesDepart = descriptionfiltreDatesDeparts.map(grep_leavingdate);
//var DateDepartMax = Math.max(...DatesDepart);
var DateDepartMax = Math.max.apply(Math, DatesDepart);
return DateDepartMax;
}
and lsc.xml :
…
<dataset>
<name>accountExpires</name>
<policy>FORCE</policy>
<forceValues>
<string><![CDATA[js:AD.getAccountExpires(return_maxleavingdate(srcBean.getDatasetFirstValueById("description")),"yyyyMMdd")]]></string>
</forceValues>
</dataset>
…
But now the error log is :
févr. 05 13:34:33 - ERROR - Fail to compute expression:
AD.getAccountExpires(return_maxleavingdate(srcBean.getDatasetFirstValueById("description")),"yyyyMMdd")
on id=uid=utest002,ou=people,dc=univ-psl,dc=fr
Reason: javax.script.ScriptException: sun.org.mozilla.javascript.EcmaError:
TypeError: Cannot find function filter in object {LEAVINGDATE}20180502.
(<Unknown source>#11) in <Unknown source> at line number 11
févr. 05 13:34:33 - ERROR - Error while synchronizing ID {uid=utest002}:
org.lsc.exception.LscServiceException: javax.script.ScriptException:
sun.org.mozilla.javascript.EcmaError: TypeError: Cannot find function filter in
object {LEAVINGDATE}20180502. (<Unknown source>#11) in <Unknown source> at line
number 11
I can see now he recovers the good value but they have a problem with filter
function...
I keep looking for solution on my side but if your have an idear or advice...
Really Thanks for your help Sosik
--
Pour toute demande de support informatique :
[email protected]<mailto:[email protected]>
Pour une assistance à distance : cliquez ici<http://get.teamviewer.com/ak6yycv>
---
Vincent Lepetit
Administrateur Systèmes, Réseaux et Télécom
Tel : +33 176 218 318
Mob : +33 634 422 573
Paris Sciences et Lettres
60 rue mazarine
Paris, 75006
http://www.univ-psl.fr<http://www.univ-psl.fr/>
Le 5 févr. 2018 à 13:20, Soisik Froger
<[email protected]<mailto:[email protected]>>
a écrit :
On 05/02/2018 11:02, Vincent LEPETIT wrote:
# java -version
java version "1.7.0_151"
OpenJDK Runtime Environment (IcedTea 2.6.11) (7u151-2.6.11-2~deb7u3)
OpenJDK 64-Bit Server VM (build 24.151-b01, mixed mode)
These two functions works in the Rhino javascript engine shipped with jdk 1.7
(Mozilla Rhino 1.7 release 3)
I've tested your code, and to make it work, I've had to replace
var DateDepartMax = Math.max(...DatesDepart);
which produce an error, with this :
DateDepartMax = Math.max.apply(Math, DatesDepart);
So it shoud work (assuming your input description array is always properly
formatted, containing values such as '{LEAVINGDATE}20151212')
--
Soisik
_______________________________________________________________
Ldap Synchronization Connector (LSC) -
http://lsc-project.org<http://lsc-project.org/>
lsc-users mailing list
[email protected]<mailto:[email protected]>
https://lists.lsc-project.org/cgi-bin/mailman/listinfo/lsc-users
_______________________________________________________________
Ldap Synchronization Connector (LSC) - http://lsc-project.org
lsc-users mailing list
[email protected]<mailto:[email protected]>
https://lists.lsc-project.org/cgi-bin/mailman/listinfo/lsc-users
_______________________________________________________________
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