Some fields I need to sync with ldap have multiple values.

I've tried to configure it in the config file - but - only the first value gets shown.

I'm guessing that these would need to be a with one entry per line.

BTW - I'd just like to add that this module has come a long way since I last looked at it - good work people - keep it up :)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Nemo34’s picture

Same request here. LDAP allows multi-valued fields which are not taken into
account by this terrific module. That would definitely help a lot.

cadeon’s picture

Ping, count me in too.

This is a very big problem for OS X Server installs, as uid is a multi-valued field in OpenDirectory. Many users have multiple usernames, but are the same user.

I found a two line patch for only the login problem here http://drupal.org/node/61858 but I can't find where to apply the patch- I don't think it applies in 4.7.

It's also a problem for ldapdata, because multiple values could be returned for user profile data such as mail and IM.

chrissearle’s picture

Just been thinking.

There's two parts to remember here.

One is that LDAP can return multivalue fields which should then be displayable (as we dicsuss here).

The other is - it would be really really nice to be able to connect these to a textarea field in the user profile module.

jsloan’s picture

I wanted to place all of the users group memberships in a profile field that was of the type "freeform list". In the function ldap_integration_user_profile_load(&$user) I've made the following change:
OLD

  // Compare against mapped fields list
  $writeout = array();
  foreach ($profile_fields as $field) {
    if (in_array($field, $ldap_drupal_mappings)) {          
     $writeout[$field] = $ldap->retrieveAttribute($user->ldap_dn, $ldap_drupal_reverse_mappings[$field]);
    }
  }

NEW

  // Compare against mapped fields list
  $writeout = array();
  foreach ($profile_fields as $field) {
    if (in_array($field, $ldap_drupal_mappings)) {
      // changed to allow multiple attribute values to populate profile text fileds.
      $tmp = $ldap->retrieveMultiAttribute($user->ldap_dn, $ldap_drupal_reverse_mappings[$field]);
      $writeout[$field] = implode("\n",$tmp);     
    }
  }

I think that perhaps the "type" of the profile field could be checked to make the use of retrieveMultiAttribute conditional, but in practice it works just a s well for single values as multiple.

chrissearle’s picture

Version: 4.7.x-1.x-dev » 6.x-1.0-alpha1

OK - I still have this general need - and I'm now up on the 6.x chain.

I still feel that the best solution would be a new type in the ldapdata_attributes array (ldap_integration/ldap_integration/ldapdata.conf.php) - if this was supported then it would be easy to add here.

miglius’s picture

Well, there are two issues - displaying multivalued ldap fields and editing them. Displaying is relatively easy one, but I have concerns about editing. Of course, when there already are several values in the ldap for the same attribute, a text area could be used for editing them, but when there is only one value, or the value in ldap is not initialized yet, the ldapdata module does not know if multivalues are allowed for this attribute in ldap or not. Trying to save multivalues for the field which does not support it will cause an errors.

chrissearle’s picture

My thoughts were that in some way the ldapdata configuration (in ldapdata.conf.php) would have enough information that ldapdata module _did_ know if it was a multi-value field.

For editing it would always display a textarea - one value per line

For display - you could either specify the separator chars in the config or - perhaps more flexible - create a theme overridable function - default it to <br/> but allow themers to change it

WorldFallz’s picture

I've got this working for d6 with the current dev. Patched attached for your enjoyment ;-)

I have no clue if this is the best way to do it, but it's working great for me atm and I don't have any more time to spend on it.

WorldFallz’s picture

Status: Active » Needs review
msielski’s picture

Just wanted to provide some feedback that the #8 patch solves this issue for me and that multi-valued attributes are now importing properly, separated by a newline.

Not familiar with the module I don't know if there is somewhere earlier in the code where it would be better to put this logic, maybe where the array is initially built.

Thanks WorldFallz.

polyformal_sp’s picture

This patch provides display and edit for multiple value fileds in the ldapdata module. I think that was the original user asked for and also my requirement. Editing is done by using a texarea and proceed the line by line,
Just define an entry in 'Attribute visibility & access control' (admin/settings/ldap/ldapdata/edit/... ) like:

mailLocalAddress|text|textarea|available E-Mail Addresses|64|64

This patch affects ldapdata.admin.inc and ldapdata.moduleand was build against the git repo.

Please review.

best ragards

Stefan Pampel

marleo’s picture

Another vote for the #8 patch, thanks WorldFallz.

Working as expected for me with the current stable version of the module, 6.x-1.0-beta3.
(Patch attached if any use, just for the line numbers.)