2014-04-01 12:18 GMT+02:00 Natan Sanson <[email protected]>: > Hi lsc users, > > I'm trying to do a DB to LDAP synch and I need to build this > synchronization rule > > If dstBean.getMainIdentifier().contains('ou=firstOu') > > <dataset> > <name>MyAttribute</name> > <policy>FORCE</policy> > </dataset> > > If dstBean.getMainIdentifier().contains('ou=secondOu') > > <dataset> > <name>MyAttribute</name> > <policy>KEEP</policy> > </dataset> > > I tried to define this flow writing > > <dataset> > <name>MyAttribute</name> > <policy> > if ((dstBean != null) && > (dstBean.getMainIdentifier().contains('ou=firstOU'))) > FORCE > else KEEP > </policy> > </dataset> > > But it seems that LSC does not evaluate JS inside the tag <policy> > > Is there any way to change the policy value during the forceValues > evaluation? Something like > > <dataset> > <name>MyAttribute</name> > <policy> > KEEP > </policy> > <forceValues> > if ((dstBean != null) && > (dstBean.getMainIdentifier().contains('ou=firstOU'))) { > var myDataSetReference = *[get > a pointer to the right object];* > myDataSetReference. > *useAMethodToModifyThePolicyEnumerationValue("FORCE");* > } > </forceValues> > </dataset> > > if this is not possible the only way I see to achieve my goal is to do a > forceValues that places the destination value, already present > > <dataset> > <name>MyAttribute</name> > <policy> > FORCE > </policy> > <forceValues> > if ((dstBean != null) && > (dstBean.getMainIdentifier().contains('ou=firstOU'))) { > > dstBean.getDatasetFirstValueById("MyAttribute"); > } > > else srcBean.getDatasetFirstValueById("MyAttribute") > </forceValues> > </dataset> > > Assuming that the attribute is Single Valued. But this way is the worst > possible. I would prefer to mantain a KEEP policy when I don't need to > FORCE the value > > Any help is appreciated > > Indeed, we cannot use JS in policy. But for me your current solution is good: FORCE the destination values in the dataset in the case you want not to modify them. If LSC sees that dataset values are the same as destination values, no modification will be made on destination.
Clément.
_______________________________________________________________ Ldap Synchronization Connector (LSC) - http://lsc-project.org lsc-users mailing list [email protected] http://lists.lsc-project.org/listinfo/lsc-users

