I think you just need to lowercase the attribute name inside SQL macro:
#gnUniqueId# -> #gnuniqueid#

Clément.


2014-07-16 11:49 GMT+02:00 Brad Firestone <[email protected]>:

> Hi All,
>
> I’m still trying to get LSC to work correctly for my needs.  I’m trying to
> sync data from a database to OpenLDAP.
> If I set it up with the “default” settings that are used in the examples,
> it works fine.
> This is using SELECT userid_db AS uid FROM ft_form_6 WHERE userid_db =
> #uid#  etc...
> All the values in the SQL Map follow this format, and the lsc.xml file has
> <pivotAttributes>uid</pivotAttributes>.
>
> However, with this arrangement, I can’t ever change the database value of
> userid_db.  (This might be needed if the user changes their name.)
> If I change the value in userid_db, then I get a second record created in
> OpenLDAP.
> Because the user’s password is stored and managed through LDAP, the
> database only has the original password.  So they
> would have to change their password after the userid_db value is changed.
>  (The clean function does remove the original
> record, so we don’t end up with multiple accounts for one user.)
>
> What I planned to do was to use a unique identifier field in the database
> as the field that would never change. This would be the pivot.
> That sould allow me to change the username and retain the original account
> in OpenLDAP, including the current password.
> However, when I try to substitute the values userid_db and uid with
> unid_db and gnUniqueId, I get the following error:
> Sychronization aborted because no source object has been found !
>
> The only thing I’m changing between successful runs and getting this error
> are the settings in the SQL Map, and the <task>.
> Here are those files that give the error:
> ——————————————
>
> <sqlMap namespace="GNPerson">
>
>         <select id="getGNPerson" resultClass="java.util.HashMap"
> parameterClass="java.util.Map">
>                 SELECT
>                         unid_db AS gnUniqueId,
>                         userid_db AS uid,
>                         mail_db AS mail,
>                         userPassword_db AS userPassword,
>                         displayName_db AS displayName,
>                         description_db AS description,
>                         vidyoDisplayName_db AS vidyoDisplayName,
>                         vidyoUserType_db AS vidyoUserType,
>                         vidyoUserGroup_db AS vidyoUserGroup,
>                         vidyoUserLocation_db AS vidyoUserLocation,
>                         chatUserType_db AS chatUserType,
>                         chatGroups_db AS chatGroups
>                 FROM ft_form_6
>                 WHERE unid_db = #gnUniqueId#
>         </select>
>
>         <select id="getGNPersonClean" resultClass="java.util.HashMap"
> parameterClass="java.util.Map">
>                 SELECT unid_db AS gnUniqueId
>                 FROM ft_form_6
>                 WHERE unid_db = #gnUniqueId#
>         </select>
>
>         <select id="getGNPersonList" resultClass="java.util.HashMap">
>                 SELECT unid_db AS gnUniqueId
>                 FROM ft_form_6
>         </select>
>
> </sqlMap>
>
> ———————————————————————
>
>   <tasks>
>     <task>
>       <name>db2ldap-users-task</name>
>       <bean>org.lsc.beans.SimpleBean</bean>
>       <databaseSourceService>
>         <name>db2ldap-db-src</name>
>         <connection reference="formtools-db-source-conn"/>
>         <requestNameForList>getGNPersonList</requestNameForList>
>         <requestNameForObject>getGNPerson</requestNameForObject>
>         <requestNameForClean>getGNPersonClean</requestNameForClean>
>       </databaseSourceService>
>
>       <ldapDestinationService>
>         <name>db2ldap-ldap-dest</name>
>         <connection reference="openldap-dest-conn"/>
>         <baseDn>ou=people,dc=mydomain,dc=org</baseDn>
>         <pivotAttributes>
>           <string>gnUniqueId</string>
>         </pivotAttributes>
>         <fetchedAttributes>
>           <string>gnUniqueId</string>
>           <string>uid</string>
>           <string>mail</string>
>           <string>userPassword</string>
>           <string>displayName</string>
>           <string>description</string>
>           <string>vidyoDisplayName</string>
>           <string>vidyoUserType</string>
>           <string>vidyoUserGroup</string>
>           <string>vidyoUserLocation</string>
>           <string>chatUserType</string>
>           <string>chatGroups</string>
>           <string>objectClass</string>
>         </fetchedAttributes>
>         <getAllFilter>(objectClass=gnPerson)</getAllFilter>
>
> <getOneFilter>(&amp;(objectClass=gnPerson)(gnUniqueId={gnUniqueId}))</getOneFilter>
>       </ldapDestinationService>
>
>       <propertiesBasedSyncOptions>
>         <mainIdentifier>"uid=" + srcBean.getDatasetFirstValueById("uid") +
> ",ou=people,dc=mydomain,dc=org"</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>FORCE</policy>
>           <forceValues>
>             <string>"gnPerson"</string>
>             <string>"top"</string>
>           </forceValues>
>           <delimiter>,</delimiter>
>         </dataset>
>
>                 <dataset>
>           <name>uid</name>
>           <forceValues>
>
> <string>js:srcBean.getDatasetFirstValueById("uid").toLowerCase()</string>
>           </forceValues>
>         </dataset>
>
>                 <dataset>
>           <name>userPassword</name>
>           <policy>KEEP</policy>
>             <forceValues>
>                 <string>"{SHA}" +
> SecurityUtils.hash(SecurityUtils.HASH_SHA1,
> srcBean.getDatasetFirstValueById("userPassword"))</string>
>             </forceValues>
>         </dataset>
>
>       </propertiesBasedSyncOptions>
>     </task>
>   </tasks>
>
> ———————————————————————
> Sample Table Entry:
>
> Field Name                      Value
> ————————————————
> submission_id                   10111
> mail_db                         [email protected]
> userid_db                               firstuser
> userPassword_db         secret
> displayName_db          First User
> description_db                  testing
> …….
> chatGroups_db           users
> unid_db                         10111
>
> ———————————————
> When using userid_db and uid, all the data syncs fine, including unid_db
> syncing to gnUniqueId.
> Does anyone have any ideas why this is failing?  When I substitute the
> field: description_db and description,
> it doesn’t give me this error either.  Both fields are type varchar.
>
> Thank you for any help you can provide!
> Brad
> _______________________________________________________________
> Ldap Synchronization Connector (LSC) - http://lsc-project.org
>
> lsc-users mailing list
> [email protected]
> http://lists.lsc-project.org/listinfo/lsc-users
>
_______________________________________________________________
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