On 21/02/2019 18:49, Karim Ayari wrote:
> 
> - Company is an active directory attribute
> - Fredurne is one on the source and i copy his value to company.
> - When fredurne change (on source) i can update company value (on dest) with 
> the new value of fredurne
> 
> I can always disable user but i don't know how to do it only when company 
> attribute is updated

You can access fetched src and dst attribute in the script and compare your src 
fredurne attribute with current dst company attribute. Since company is updated 
with fredurne, it they are different, it means fredurne attribute has just 
changed in OpenLDAP.

Try this :

<dataset>
      <name>userAccountControl</name>
      <policy>FORCE</policy>
      <forceValues>
      <string>
        var uac = dstBean.getAttributeValueById('userAccountControl'); 
        if ( srcBean.getDatasetFirstValueById("fredurne") != 
dstBean.getDatasetFirstValueById("company")) {
                uac = AD.userAccountControlSet( "0", 
[AD.UAC_SET_ACCOUNTDISABLE]);
        }
        uac;
      </string>
      </forceValues>
    </dataset>

Please note, looking at 
https://lsc-project.org/documentation/latest/configuration/syncoptions#functionality_matrix
 : 
- <createValues> only applies when a new entry is being created, but you are 
updating entry only according to your conf. I would use <forceValues> instead.
- <defaultValues> only applies when a attribute is being added, so you should 
use <forceValues> if you want your dst company attribut to be updated every 
time it changes in src.

-- 
Soisik Froger | Software Architect

[email protected]
+33 6 49 00 09 55

Worteks | https://www.worteks.com
_______________________________________________________________
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

Reply via email to