I'm not able to import fields from LDAP, although I have access to them. This is what I have in my settings.php, is there anything else I should do?

$conf['simple_ldap_user_attribute_map'] = array(
  //Full name
  array(
    'drupal' => '#profile_full_name',
    'ldap' => 'cn',
  ),
  //Job title
  array(
    'drupal' => '#profile_job_title',
    'ldap' => 'title',
  ),
  //Location
  array(
    'drupal' => '#profile_building_name',
    'ldap' => 'buildingname',
  ),
  //Telephone number
  array(
    'drupal' => '#profile_telephone',
    'ldap' => 'telephonenumber',
  ),
  //Mobile number
  array(
    'drupal' => '#profile_mobile_number',
    'ldap' => 'mobile',
  ),
  //E-mail
  array(
    'drupal' => '#mail',
    'ldap' => 'mail',
  ),
  //Picture
  array(
    'drupal' => '#picture',
    'ldap' => 'jpegphoto',
  ),
);

Comments

blc’s picture

  //E-mail
  array(
    'drupal' => '#mail',
    'ldap' => 'mail',
  ),

Is this separate from the user's Drupal "mail" attribute, which is defined in the UI? My initial thoughts are that if you have the LDAP 'mail' attribute mapped to multiple Drupal user attributes, that may be causing a silent failure.

What does the rest of your configuration look like? If you have drush, the following will give you the values (please scrub your bind credentials before posting here)

$ drush vget simple_ldap

guardiola86’s picture

The problem is in the file simple_ldap_user.module in line 566. The function field_info_field is not getting any info from fields like name or profile_full_name.

guardiola86’s picture

I have to say as well that I can access all ldap and drupal fields properly. The problem is with that function, as the result is null $edit is going to be always empty.

blc’s picture

Are these user fields from the built-in user entity fields, or are they from something like the profile2 module? Currently, there is only support for the built-in user attributes, such as 'name' or 'mail', and fields added through the native user fields at admin/config/people/accounts/fields

guardiola86’s picture

I'm using Profile module which comes with the core in D7. I'm trying to map the fields in admin/config/people/profile such as profile_full_name or profile_telephone. If I'm not able to map them straightaway with Simple Ldap module, would it be possible to do it with Ldap module? Definitely I need to map this fields somehow :(

blc’s picture

According to http://drupal.org/node/874026, the Profile module is deprecated in D7, and is only included in core for backwards compatibility. So, there will be no support for it in simple_ldap. Sorry.

That said, it would be great to have support for Profile2 (http://drupal.org/project/profile2), but it has not made it on to my roadmap just yet. Patches are welcome, of course!

If you convert your profile fields to use the built in field API, you can certainly use simple_ldap to manage these values. I am not sure what kind of support that the Ldap project supports these different field types.

guardiola86’s picture

The site I'm working on was in Drupal 6 and I've upgraded it to Drupal 7, so that's the reason I have the module Profile installed. How could I then migrate these fields to use the field API. Maybe this module or any similar could help on this? http://drupal.org/project/field_convert

guardiola86’s picture

I've been able to migrate profile fields using this: http://drupal.org/sandbox/davereid/1611648

The thing is that is not the best thing to use a sandbox project on a production site. Migrate to profile2 would be the best thing to do, but I've seen neither LDAP or Simple LDAP support it. Is there any stable module to used instead of this sandbox project?

jelutz77’s picture

Is there some sort of guide I can use for mapping user attributes to LDAP attributes? I saw this post, but I know he said it isn't working correctly. And there doesn't seem to be a consistent format that I see here. What does work correctly?