Le 16/12/2015 12:35, [email protected] a écrit :
> Hi,
>
> I'm trying to synchronize group membership from a SQL database to a
> LDAP server.
>
> I've been able to extract membership from the SQL server as a string
> 'user1,user2,user3' and insert them in the LDAP directory by using
> <delimiter>,</delimiter> in the corresponding dataset.
>
> Now, what if in the process I need to add a DN suffix to each user
> entries, ie user1,ou=xx,cn=y,cn=z ?
>
> When trying to use srcBean.getDatasetValuesById("owner"), which
> returns a List, I only get a single element list containing the whole
> users list above... while I need as many elements as users.
>
> Do I have to convert something ?
>
>
Here is the solution:
var groupmembers = srcBean.getDatasetFirstValueById("owner").split(',');
var memberdns = [] ;
for (var i=0; i < groupmembers.length; i++) {
memberdns.push("uid=" + groupmembers[i] + ",ou=xx,cn=y,cn=z");
}
memberdns;
The essential part that led me to the correct solution was to use
getDatasetFirstValueById (which returns a single string containing the
',' separated usernames) instead of
getDatasetValuesById (which returns a List of string)
Thanks :)
--
Martin
_______________________________________________________________
Ldap Synchronization Connector (LSC) - http://lsc-project.org
lsc-users mailing list
[email protected]
http://lists.lsc-project.org/listinfo/lsc-users