Hello,

I'd like to sync users and groups from AD to the executable plugin in
order to call REST API.
I am new to lsc so I tried to write the lsc.xml to the best of my
understanding but when running lsc I get this:
ERROR - org.lsc.exception.LscConfigurationException: Configuration
exception: org.lsc.configuration.PluginConnectionType cannot be cast
to org.lsc.configuration.LdapConnectionType

The command line I used is:
JAVA_OPTS="-DLSC.PLUGINS.PACKAGEPATH=org.lsc.plugins.connectors.executable.generated"
lsc -f etc/ -s all -t 1 -n

I'm running on Ubuntu 16.04.
The contents of lsc.xml are below.

TIA,
Lior

<?xml version="1.0" ?>
<lsc xmlns="http://lsc-project.org/XSD/lsc-core-2.1.xsd";
xmlns:exec="http://lsc-project.org/XSD/lsc-executable-plugin-1.0.xsd";
revision="0">
 <connections>
   <ldapConnection>
             <name>ad-src</name>
             <url>ldap://ad-testing.of.io:389/dc=ad,dc=com</url>
             <username>cn=lior,ou=ad-testing,ou=Users,dc=of,dc=io</username>
             <password>password</password>
             <authentication>SIMPLE</authentication>
             <referral>IGNORE</referral>
             <derefAliases>NEVER</derefAliases>
             <version>VERSION_3</version>
             <pageSize>1000</pageSize>
             <factory>com.sun.jndi.ldap.LdapCtxFactory</factory>
             <tlsActivated>false</tlsActivated>
   </ldapConnection>
   <pluginConnection>
     <name>executable</name>
     <url>fake</url>
     <username>fake</username>
     <password>fake</password>
   </pluginConnection>
 </connections>
 <tasks>
   <task>
     <name>AD-Test</name>
     <bean>org.lsc.beans.SimpleBean</bean>
     <ldapSourceService>
       <name>AD-src</name>
       <connection reference="ad-src" />
           <baseDn>ou=location,ou=Employees,ou=Users,dc=ad,dc=com</baseDn>
       <pivotAttributes>
         <string>sAMAccountName</string>
       </pivotAttributes>
       <fetchedAttributes>
         <string>cn</string>
         <string>sn</string>
         <string>givenName</string>
         <string>description</string>
         <string>objectClass</string>
         <string>sAMAccountName</string>
         <string>telephoneNumber</string>
         <string>title</string>
         <string>displayName</string>
         <string>mail</string>
       </fetchedAttributes>
       <getAllFilter><![CDATA[(objectClass=user)]]></getAllFilter>
       
<getOneFilter><![CDATA[(&(objectClass=user)(sAMAccountName={sAMAccountName}))]]></getOneFilter>
       
<cleanFilter><![CDATA[(&(objectClass=user)(sAMAccountName={uid}))]]></cleanFilter>
     </ldapSourceService>
       <pluginDestinationService
implementationClass="org.lsc.plugins.connectors.executable.ExecutableLdapDestinationService">
         <name>user-dst-service</name>
         <connection reference="executable" />
         <exec:executableLdapDestinationServiceSettings>
           <name>user-dst-service-exec</name>
           <connection reference="executable" />
           <baseDn>ou=users,dc=example,dc=com</baseDn>
           <pivotAttributes>
             <string>uid</string>
           </pivotAttributes>
           <fetchedAttributes>
             <string>cn</string>
             <string>givenName</string>
             <string>objectclass</string>
             <string>sn</string>
             <string>uid</string>
           </fetchedAttributes>
           <getAllFilter><![CDATA[(objectClass=inetOrgPerson)]]></getAllFilter>
           
<getOneFilter><![CDATA[(&(objectClass=inetOrgPerson)(uid={uid}))]]></getOneFilter>
           <exec:addScript>/home/ubuntu/add.sh</exec:addScript>
           <exec:updateScript>/home/ubuntu/update.sh</exec:updateScript>
           <exec:removeScript>/home/ubuntu/remove.sh</exec:removeScript>
           <exec:renameScript>/home/ubuntu/rename.sh</exec:renameScript>
           <exec:variables>
             <entry><key>key</key><value>value</value></entry>
             <entry><key>key2</key><value>value2</value></entry>
           </exec:variables>
         </exec:executableLdapDestinationServiceSettings>
       </pluginDestinationService>
     <propertiesBasedSyncOptions>
       <mainIdentifier>"cn=" + srcBean.getDatasetFirstValueById("cn")
+ ",ou=location,ou=Employees,ou=Users,dc=ldap,dc=local"</mainIdentifier>
       <defaultDelimiter>;</defaultDelimiter>
       <defaultPolicy>FORCE</defaultPolicy>
       <conditions>
         <create>true</create>
         <update>true</update>
         <delete>true</delete>
         <changeId>false</changeId>
       </conditions>
       <dataset>
         <name>objectClass</name>
         <policy>KEEP</policy>
         <createValues>
           <string>"inetOrgPerson"</string>
           <string>"organizationalPerson"</string>
           <string>"person"</string>
           <string>"top"</string>
         </createValues>
       </dataset>
                       <dataset>
                       <name>uid</name>
                       <policy>FORCE</policy>
                         <forceValues>

<string>srcBean.getDatasetFirstValueById("sAMAccountName")</string>
                         </forceValues>
                       </dataset>
                       <dataset>
                       <name>cn</name>
                       <policy>FORCE</policy>
                         <forceValues>

<string>srcBean.getDatasetFirstValueById("cn")</string>
                         </forceValues>
                       </dataset>
                       <dataset>
                       <name>sn</name>
                       <policy>FORCE</policy>
                         <forceValues>

<string>srcBean.getDatasetFirstValueById("sn")</string>
                         </forceValues>
                       </dataset>
                       <dataset>
                       <name>givenName</name>
                       <policy>FORCE</policy>
                         <forceValues>

<string>srcBean.getDatasetFirstValueById("givenName")</string>
                         </forceValues>
                       </dataset>
                       <dataset>
                       <name>description</name>
                       <policy>FORCE</policy>
                         <forceValues>

<string>srcBean.getDatasetFirstValueById("description")</string>
                         </forceValues>
                       </dataset>
                       <dataset>
                       <name>telephoneNumber</name>
                       <policy>FORCE</policy>
                         <forceValues>

<string>srcBean.getDatasetFirstValueById("telephoneNumber")</string>
                         </forceValues>
                       </dataset>
                       <dataset>
                       <name>title</name>
                       <policy>FORCE</policy>
                         <forceValues>

<string>srcBean.getDatasetFirstValueById("title")</string>
                         </forceValues>
                       </dataset>
                       <dataset>
                       <name>displayName</name>
                       <policy>FORCE</policy>
                         <forceValues>

<string>srcBean.getDatasetFirstValueById("displayName")</string>
                         </forceValues>
                       </dataset>
                       <dataset>
                       <name>mail</name>
                       <policy>FORCE</policy>
                         <forceValues>
                                  <string>
                                              <![CDATA[{
                                                          var email =
srcBean.getDatasetFirstValueById("mail");
                                                          var
emaillocal = email.substr(0, email.indexOf('@'));
                                                          var domain = "@ad.";
                                                          var
topleveldomain = email.slice(-2);
                                                          var
emailsecond = emaillocal.concat(domain);
                                                          var
emailfinal = emailsecond.concat(topleveldomain);
                                              }
                                              emailfinal
                                              ]]>
                                  </string>
                         </forceValues>
                       </dataset>
     </propertiesBasedSyncOptions>
   </task>
 </tasks>
</lsc>
_______________________________________________________________
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