LDAP Feeds Example: Sync LDAP Data to Existing Drupal User

Last updated on
19 November 2017

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

Step By Step Example of Using LDAP Feeds "Drupal User LDAP Entry Fetcher" to
bring in profile data of existing users.
To keep this fresh, include comments on which versions of ldap_feeds, feeds, and drupal you tried this example with. Please edit for clarity

/FeedsUserProcessor)

[Example]
  Replace/Update existing users: checked
  Text format: plain text
  Status: active
  Additional Roles: none
[/Example]
  1. Configure an ldap server. Make sure fields related to ldap and drupal users are filled out.
  2. Enable the following modules: feeds, ldap_feeds
  3. Add user account fields (admin/config/people/accounts/fields)
    [Example]
      First Name Field:  First Name, field_fname, text, text field
      Last Name Field:  Last Name, field_lname, text, text field
      DN Field: LDAP DN, field_dn, text, text field
    [/Example]
  4. Create new Feed importer: admin/structure/feeds/create
    [Example]
      Name: LDAP Data to User Fields
      Machine-Readable name: ldap_data_to_user_fields
      Description: admin/structure/feeds/ldap_data_to_user_fields/settings
    [/Example]
  5. Configure Basic Settings: admin/structure/feeds/ldap_data_to_user_fields/settings
    [Example]
      Attach to content type: Use standalone form
      Periodic Import: Off (can turn on after testing)
      Import on Submission: checked
      Processed in background:  unchecked.  (Check after testing for larger number of users)
    [/Example]
  6. Set Fetcher to "Drupal User LDAP Entry Fetcher" (admin/structure/feeds/ldap_data_to_user_fields/fetcher)
  7. There are no Fetcher Settings (admin/structure/feeds/ldap_data_to_user_fields/settings/FeedsDrupalUserLdapEntryFetcher)
  8. Set Parser to "LDAP Entry Parser for Feeds" (admin/structure/feeds/ldap_data_to_user_fields/parser)
  9. There are no Parser Settings
  10. Change processor to "User Processor" (admin/structure/feeds/ldap_data_to_user_fields/processor)
  11. Set user processor settings (admin/structure/feeds/ldap_data_to_user_fields/settings
  12. Set Mappings (admin/structure/feeds/ldap_data_to_user_fields/mapping)
    If you have selected a test user in your ldap server configuration, you should get example values in the "legend" sources table.
    [Example]
      SOURCE,      TARGET,         UNIQUE TARGET
      givenname,   First Name,     unchecked
      sn,          Last Name,      unchecked
      drupal.name, User Name,      checked
    [/Example]
  13. Execute the import. (import) -> (import/ldap_data_to_user_fields)

Caveats:

  • Feeds User Processor is a little fuzzy on update behavior for users. See issue #1300764
  • Mapping must include either "name" and "mail" fields as "Unique Targets" to affect existing users. GUIDs such as dn used as unique identifiers won't affect existing users.
  • It should be noted that this process will only sync users that currently exist as Drupal users with their information from an ldap server. If you want to import all of the users from a LDAP server you create an Ldap Query to import all of the users.
  • There is a section in the configuration that allows you to delete users that are no longer in the feed. This will also delete any nodes that they have created. Look for "Action to take when previously imported users are missing in the feed".

Help improve this page

Page status: No known problems

You can: