2012/10/25 Juan Asensio Sánchez <[email protected]>:
> Hi
>
> I am trying to sync the nsAccountLock from my 389DS to AD. I have a
> forceValues section for the userAccountControl attribute:
>
> ...
>         <defaultPolicy>FORCE</defaultPolicy>
> ...
>
>         <dataset>
>           <name>userAccountControl</name>
>
>           <forceValues>
>             <string><![CDATA[js:
>
> var uac =  dstBean.getDatasetFirstValueById('userAccountControl');
>
> // Desactivación de la cuenta
> if ( ( srcBean.getDatasetFirstValueById("nsAccountLock") != null ) &&
> ( srcBean.getDatasetFirstValueById("nsAccountLock").equalsIgnoreCase("true")
> ) ) {
>   // Comprobar y desactivar cuenta
>   if ( ! AD.userAccountControlCheck (uac, AD.UAC_ACCOUNTDISABLE) ) {
>     uac = AD.userAccountControlSet( uac, [AD.UAC_SET_ACCOUNTDISABLE] );
>   }
> }
> else {
>   // Comprobar y activar cuenta
>   if ( AD.userAccountControlCheck (uac, AD.UAC_ACCOUNTDISABLE) ) {
>     uac = AD.userAccountControlSet( uac, [AD.UAC_UNSET_ACCOUNTDISABLE] );
>   }
> }
>
> // Devolver el valor modificado del atributo
> uac;
>
>             ]]></string>
>           </forceValues>
>         </dataset>
>
>
> But when a entry is going to be created, I get an exception because
> dstBean is not defined:
>
> oct 25 10:41:14 - ERROR - javax.script.ScriptException:
> sun.org.mozilla.javascript.internal.EcmaError: ReferenceError:
> "dstBean" is not defined. (<Unknown source>#5) in <Unknown source> at
> line number 5
>
> I can create a createValues section that haven't a reference to
> dstBean, but when a entry is created, the forceValues code is also
> executed, and I get the error. How can I do this?



Of course, you cannot acces dstBean when the distant entry does not
exists. You have to set forceValues and createValues in your dataset
to handle both cases.

Clément.
_______________________________________________________________
Ldap Synchronization Connector (LSC) - http://lsc-project.org

lsc-users mailing list
[email protected]
http://lists.lsc-project.org/listinfo/lsc-users

Reply via email to