I have attempted to sync ldap profile fields to a user profile with no luck.
Running a test on a user does display their LDAP data; however, it does not sync with their user profile.
Looking at ldap_profile.module, around line 87 --
if (is_array($account->data) && array_key_exists("ldap_authentication", $account->data)) {
I did a print_r on $account and the data property is empty.
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | ldap-user-sync-1543382-15.patch | 616 bytes | larowlan |
| #12 | ldap_profile_mapping.patch | 1.12 KB | michaelfavia |
| #7 | 1543382-7-Sync-To-User-Fields.patch | 10.12 KB | larowlan |
| #6 | 1543382-6-Sync-To-User-Fields.patch | 10.1 KB | larowlan |
Comments
Comment #1
johnbarclay commentedpatches are welcome on this one. I'm working on the 2.0 branch currently where the ldap_profile module is replaced by ldap_user with a may 15 deadline. Its unlikely I will get to this one.
Comment #2
geekluv commentedI'm happy to investigate and fix this -- could you give me an idea of where in the process the "account->data" should be initially set?
Comment #3
johnbarclay commentedI'm not familiar with the ldap_profile module at all. Sorry.
Comment #4
smsearcy commentedI encountered this issue as well. I fixed it by checking if the user had authenticated via LDAP with ldap_authentication_ldap_authenticated(), but now I think that is a regression of #1532084: LDAP Profile: Error when ldap_profile enabled without ldap_authentication. It looks like it was expecting ldap_authentication to save some information in $account->data (I have ldap_authorization enabled and it does this). Otherwise I'm not sure how it would know the current user has an entry in LDAP (unless we just try to look up the user if there are LDAP servers?).
Anyway, this is what seems to be working for me in beta10 before I gave it as much thought as I just wrote above. Probably not patch worthy yet since it regresses the other fix and I probably should loop through the servers instead of just grabbing the first one (but I'm not currently setup to test that).
ldap_profile.module (beta10, starting at line 86)
Comment #5
johnbarclay commentedComment #6
larowlanPatch gets field update working.
Summary of changes:
Adds
Comment #7
larowlanRe-roll against 2.x
Comment #8
larowlanComment #9
johnbarclay commentedThanks. I applied this and it all looked good to me. When you get a chance, confirm that its working for you. I changed this to a task to make sure simpletest coverage is finished for this at some point.
Comment #10
larowlanJohn
New 2.x dev version tests fine for syncing to fields on the user entity FROM ldap.
Marking back to active for tests.
Thanks
Will try and catch you next week to discuss next steps.
Comment #11
alanrussian commentedFor 7.x-1.x: This will loop through the servers. I'm not sure what to do about the regression of issue #1532084: LDAP Profile: Error when ldap_profile enabled without ldap_authentication, though. Thanks, smsearcy.
Comment #12
michaelfavia commentedFrom what i can tell fropmt he comments above 2.x is fixed on this issue? switching to 1.x and review if this is the case.
#4 may not be patch worthy but it got the job done for me and i tried migrating to 2.x but wanst able to get things inline. Attached patch for similarly adventurous souls that don't care about the regression i suppose.
Comment #13
johnbarclay commentedYeah. This is fixed in 2.0, but 2.0 is still unstable.
I would stay away from the 2.0 branch for the short term unless are testing or need features not in 1.0. Here is a thread on the 2.0 branch which has a rewrite of provisioning to and from ldap in the ldap_user module. #1622942: LDAP User: Ldap Provisioning in LDAP 7.x-2.x Branch General Discussion thread
Also there will be a update script for 7.x-1.x to 7.x-2.x but only for the release candidates, not beta to dev.
Comment #14
larowlanJohn note my patch above was not case agnostic, ie user fields on ldap may not match case of fields entered in mapping. Will re-roll fix for case-agnostic attributes.
Comment #15
larowlanPatch is for 2.x
Adds case agnostic attribute mapping.
Comment #16
johnbarclay commentedin 7.x-2.x-dev this is dealt with as follows in order to dealt with the [:;] syntax of the tokens.
I think the equivelent change would be:
- $attr_name = $parts[0];
+ $attr_name = ldap_server_massage_text($parts[0], 'attr_name', LDAP_SERVER_MASSAGE_TOKEN_REPLACE) ;
to the following code. Does this make sense?
Comment #17
larowlanThis patch is more to do with the attribute names entered by the admin in the mapping screen. The field sync code looks for the exact case they enter, but this is not correct. Does the massage text code deal with that too?
Comment #18
johnbarclay commentedyeah. the massage code is just a way of being consistent about case sensitivity. it could just as easily be drupal_strtolower for many cases, but I wanted to have a function that clarified how case sensitivity was being dealt with.
Comment #19
denix commentedHi Guys,
how can I make this work with version 7.x-1.0-beta12? I'm not yet confident enough to go dev on a production environment and the code between the 1-dev and 1-beta is quite different.
Best,
Denix
Comment #20
johnbarclay commentedA final patch for the 7.x-1.x-dev version would be helpful, but I don't plan to do any work on 7.x-1.x-dev except applying patches and backporting easy backports.
Comment #22
grahlComment #30
grahlNo feedback, closing.