It's problem in both LDAP Feeds and LDAP User modules.
I've created a multivalue field field_member_groups with unlimited number of values and 4096 bytes field size.

LDAP User:

In section Provisioning from LDAP to Drupal Mapppings of LDAP User configuration I've set mapping from [memberOf] to Field: AD groups
After user logged in I see only one value from 11 values in LDAP.

LDAP Feeds:

In LDAP Query field Attributes to return is empty (that means All attributes).
Fetcher is LDAP Query Fetcher. Also i have a mapping in Mapping for User processor configuration which maps from memberof to AD groups. After import i have only one value in field_member_groups field.

I know about LDAP tokens [field:0], [field:1], [field:last]. I think that it is bad idea to make multivalue import by default for token [field], cause it can produce a lot of problems for default usage of this mapping (in LDAP we have default 1 value for field). May be it would be good if we will have a new option in LDAP tokens - [field:all] ?

I've no idea for LDAP Feeds but in real it is more importan for me. May be it would be new option:

Multiple values:
[*] All
[ ] First only
[ ] Last only
[ ] Nth: ______

About basic goals of this exorcism.
I need function which can import all permission information from LDAP (Active Directory) to Drupal field before user logged in. I need this information for Drupal's workflow application function to select a group of AD users. And this function must be independent of previous user activity on Drupal site. This requirement eliminates LDAP Authorization functionality.

Comments

johnbarclay’s picture

Title: Multiple LDAP fields values aren't imported completely. Only one value is imported from LDAP to Drupal multivalue field. » LDAP User: Multiple LDAP fields values aren't imported completely. Only one value is imported from LDAP to Drupal multivalue.

This functionality would go in LDAP User module in the provisioning/synching aspect in the LDAP to Drupal direction. Like binary field support its a field mapping issue that can get quite complex as it does in the Feeds module. See also #1705984: Use LDAP Query and Feeds mapping with multi-valued attributes

trumanru’s picture

Status: Active » Needs work

I think it needs work on dev-2.x version. Right?

johnbarclay’s picture

yes the 7.x-2.x-dev branch is the place for this work. If feeds, entity api, or feeds tamper are useful dependencies for any of this, I'd prefer to add them as dependencies than replicate their code. The general issue is supporting non standard fields, which include multivalue, binary, compound, etc.

michaelfavia’s picture

StatusFileSize
new1.07 KB

The attached patch detects multi value fields and appends the values into an array. feeds importer handles the rest. this has been tested with multivalue text fields, taxonomy terms, etc

michaelfavia’s picture

StatusFileSize
new1.07 KB

Please excuse the previous patch. it was headed the wrong direction

jkingsnorth’s picture

Issue summary: View changes

Just wondering why it would be a problem to just pass the whole array through, why do we need to rewrite it like your patch does?
ie: (where the 'else' says, 'if it IS an array...')

else {
  unset($ldap_attributes[$source_lcase]['count']);
  $parsed_item[$source] = $ldap_attributes[$source_lcase];
}

(Apologies for the lack of a real patch)

jkingsnorth’s picture

Title: LDAP User: Multiple LDAP fields values aren't imported completely. Only one value is imported from LDAP to Drupal multivalue. » LDAP feed import does not support multiple values per attribute (arrays of more than 1 value are not supported)
Status: Needs work » Needs review

I submit, patch of the above attached. But there's probably a very good reason not to do it this way?

jkingsnorth’s picture

StatusFileSize
new694 bytes
johnbarclay’s picture

If someone could test this patch, I'm happy to commit it.

peterpoe’s picture

Status: Needs review » Reviewed & tested by the community

Works fine for me.

jkingsnorth’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new705 bytes

The coding style on this patch was terribly, sorry. Please find a better one attached. I've set this back to needs review. Could someone confirm that it still works and there are no security (or other) implications?

Rmeja’s picture

The patch works perfectly and matches our expectations

romainj’s picture

Thanx works like a charm!

jkingsnorth’s picture

Status: Needs review » Reviewed & tested by the community

3 reviews in total, marking as RTBC

lpalgarvio’s picture

reviving

bulldozer2003’s picture

The patch in comment #11 works and should be committed.

cdmo’s picture

#11 works, agree that this is RTBC. thanks.

queenvictoria’s picture

Status: Reviewed & tested by the community » Fixed

Committed thanks!

lpalgarvio’s picture

Please issue new beta release

kcolwell’s picture

This patch just saved me so much time!

Thanks for the awesome code!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.