Hi
I think it would be like this:
=======================================================
<defaultPolicy>FORCE</defaultPolicy>
<conditions>
<changeId>false</changeId>
</conditions>
<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>
<createValues>
<string><![CDATA[js:
var uac = AD.userAccountControlSet( "0", [AD.UAC_SET_NORMAL_ACCOUNT] )
// 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>
</createValues>
</dataset>
=======================================================
But I am already getting the error:
oct 25 12:46:56 - 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
As it looks is also executing the forceValues...
2012/10/25 Clément OUDOT <[email protected]>:
> 2012/10/25 Juan Asensio Sánchez <[email protected]>:
>> Hi
>>
>> So, how can I detect in the forceValues if dstBean is defined? If I do:
>>
>> if (dstbean) { ... }
>>
>> I get the error anyway...
>
> Use createValues to specify how the value is created when the entry is
> created, and forceValues to force value when modifying existing entry.
_______________________________________________________________
Ldap Synchronization Connector (LSC) - http://lsc-project.org
lsc-users mailing list
[email protected]
http://lists.lsc-project.org/listinfo/lsc-users