I've set up an LDAP query and a corresponding Feeds importer to grab the office name (physicaldeliveryofficename, in Active Directory) to populate nodes in a content type called Office. When I execute the import, it only pulls one record which has a blank Title (mapped to the office name field in AD). I know that my LDAP query is working as it pulls data properly into Views, and my standard user LDAP connection works great pulling that field too. The log reports no errors.

Comments

Saoirse1916 created an issue. See original summary.

Saoirse1916’s picture

StatusFileSize
new106.37 KB
new32.52 KB

Adding a few more screenshots indicating that the LDAP query works fine as does the view which calls it -- it's the feed that's the problem, as it only imports 1 node with no title.

Saoirse1916’s picture

For testing, I've changed the import to pull all users into Drupal (including the office name) which works just fine. That would lead me to believe that the problem lies in the Node Processor section, as the User Processor works with the LDAP query.

More specifically, the problem has to do with the combination of LDAP Query Fetcher and Node Processor, as LDAP Query Fetcher/User Processor works as does Drupal User LDAP Entry Fetcher/Node Processor.

martin.knapp’s picture

I think I have the same problem. I want to set up a query to import LDAP users as Drupal nodes (the idea is to display the members of an agency, but not to provide them with login credentials).
I have :

  • set up a content type, "Agent" with several fields
  • set up an LDAP Server (the connection tests ok)
  • created an LDAP Query (the query tests ok and lists the expected data)
  • set up a Feed (export below)

First thing I notice is that when I try to execute the Feed via cron, nothing appears to happen (the job executes very fast - much too fast for it to have executed the LDAP query, which is long).
I therefore try to execute the Feed via "form submission".
When I first created the Feed, I tried to put the "displayName" LDAP attribute into the Title field of the Agent content type and to make this the unique identifier. However when I submitted the "Create agent" form, I then got an error to the effect that it was unable to match the Title field.
So I tried again, installed Automatic Node Title module to generate a title, and put the displayName into another field.
This time, I got a better result. The return message was "1 node created, 22 updated" - so at least something is getting into the system! But what appears to be happening is that no account is taken of the unique ids. The first entry causes the node to be created, all the others cause it to be updated despite the fact that their unique identifiers (DN => GUID) are different.
Here is the Feed configuration:

$feeds_importer = new stdClass();
$feeds_importer->disabled = FALSE; /* Edit this to true to make a default feeds_importer disabled initially */
$feeds_importer->api_version = 1;
$feeds_importer->id = 'ldap_cap_soutien';
$feeds_importer->config = array(
  'name' => 'LDAP Cap Soutien',
  'description' => 'Importation des données annuaires de Cap Soutien',
  'fetcher' => array(
    'plugin_key' => 'FeedsLdapQueryFetcher',
    'config' => array(
      'query_ids' => array(
        'cap_soutien_1' => 'cap_soutien_1',
      ),
    ),
  ),
  'parser' => array(
    'plugin_key' => 'FeedsLdapEntryParser',
    'config' => array(),
  ),
  'processor' => array(
    'plugin_key' => 'FeedsNodeProcessor',
    'config' => array(
      'expire' => '-1',
      'author' => '1',
      'authorize' => 1,
      'mappings' => array(
        0 => array(
          'source' => 'dn',
          'target' => 'guid',
          'unique' => 1,
          'language' => 'und',
        ),
        1 => array(
          'source' => 'uidRH',
          'target' => 'field_identifiant_dgfip',
          'unique' => FALSE,
          'language' => 'und',
        ),
        2 => array(
          'source' => 'affectationSAGES',
          'target' => 'field_sages',
          'unique' => FALSE,
          'language' => 'und',
        ),
        3 => array(
          'source' => 'roomNumber',
          'target' => 'field_piece',
          'unique' => FALSE,
          'language' => 'und',
        ),
        4 => array(
          'source' => 'displayName',
          'target' => 'field_nom_affiche',
          'unique' => FALSE,
          'language' => 'und',
        ),
        5 => array(
          'source' => 'telephoneNumber',
          'target' => 'field_telephone',
          'unique' => FALSE,
          'language' => 'und',
        ),
      ),
      'insert_new' => '1',
      'update_existing' => '2',
      'update_non_existent' => 'delete',
      'input_format' => 'plain_text',
      'skip_hash_check' => 0,
      'bundle' => 'agent',
      'language' => 'und',
    ),
  ),
  'content_type' => 'agent',
  'update' => 0,
  'import_period' => '0',
  'expire_period' => 3600,
  'import_on_create' => 1,
  'process_in_background' => 0,
);

Saoirse1916’s picture

@martin.knapp glad to see I'm not the only one struggling with this!

grahl’s picture

Status: Active » Closed (cannot reproduce)

Just tried to reproduce this and it works fine, here is my minimal example with mail, name and guid set:

$feeds_importer = new stdClass();
$feeds_importer->disabled = FALSE; /* Edit this to true to make a default feeds_importer disabled initially */
$feeds_importer->api_version = 1;
$feeds_importer->id = 'ldap_example';
$feeds_importer->config = array(
  'name' => 'LDAP example',
  'description' => '',
  'fetcher' => array(
    'plugin_key' => 'FeedsLdapQueryFetcher',
    'config' => array(
      'query_ids' => array(
        1 => '1',
      ),
    ),
  ),
  'parser' => array(
    'plugin_key' => 'FeedsLdapEntryParser',
    'config' => array(),
  ),
  'processor' => array(
    'plugin_key' => 'FeedsUserProcessor',
    'config' => array(
      'roles' => array(
        3 => 0,
      ),
      'status' => '1',
      'defuse_mail' => 0,
      'mappings' => array(
        0 => array(
          'source' => 'dn',
          'target' => 'guid',
          'unique' => FALSE,
          'language' => 'und',
        ),
        1 => array(
          'source' => 'cn',
          'target' => 'name',
          'unique' => FALSE,
          'language' => 'und',
        ),
        2 => array(
          'source' => 'mail',
          'target' => 'mail',
          'unique' => FALSE,
        ),
      ),
      'insert_new' => '1',
      'update_existing' => '2',
      'update_non_existent' => 'skip',
      'input_format' => 'plain_text',
      'skip_hash_check' => 0,
      'bundle' => 'user',
      'language' => 'und',
    ),
  ),
  'content_type' => '',
  'update' => 0,
  'import_period' => '-1',
  'expire_period' => 3600,
  'import_on_create' => 1,
  'process_in_background' => 0,
);

See also https://www.drupal.org/docs/7/modules/lightweight-directory-access-proto...