Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I need to import users photos from thumbnailPhoto field in ActiveDirectory to Drupal user profile for use as user picture.
Comment | File | Size | Author |
---|---|---|---|
#31 | ldap_7.x-2.x-dev_Photo0.1.diff | 70.32 KB | vgalindus |
#21 | ldap_7.x-2.x-dev_Photo.patch | 13.69 KB | omaster |
#19 | ldap_7.x-2.x-dev_Photo.patch | 266.65 KB | omaster |
#14 | _ldap_7.x-2.0-beta3_thumbnailPhoto_1774936_13.diff | 246.33 KB | vgalindus |
Comments
Comment #1
johnbarclay CreditAttribution: johnbarclay commentedThis is core to the ldap 7.x-2.x branch in LDAP User. I'm tagging this as simpletest so that image uploads are covered in the simpletests. Part of its implementation has to do with binary fields, in some ldaps.
Comment #2
trumanru CreditAttribution: trumanru commentedThank you for good job. This module helps me to enroll Drupal in my company enterprise environment.
Am I correctly understanding that import thumbmailPhoto is available now in 7.x-2.x-dev branch?
Where can I read a manual to setup it?
I've tried to set up mapping "[thumbnailphoto]" to new Image field in user profile ("Test LDAP Server 1 for LDAP Authorization LDAP Server Mappings" section on "Ldap Configuration - 3. User" tab with LDAP Server connection provided by LDAP SipleTest module) but it doesn't work.
Comment #3
omaster CreditAttribution: omaster commentedI have not been able to get image success either.
Comment #4
trumanru CreditAttribution: trumanru commented@omaster - why? What is the problem?
I thought that it is jpeg picture which we can get and directly save to user profile without any convertion.
Comment #5
omaster CreditAttribution: omaster commentedI haven't been able to get the jpegPhoto into the user Photo. first I can't select the standard user photo Field to place it into. And then if I create an image field to try and place it in it says this when a user logs in.
PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '[jpegPhoto]' for column 'fid' at row 1: INSERT INTO {file_usage} (fid, module, type, id, count) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => [jpegPhoto] [:db_insert_placeholder_1] => file [:db_insert_placeholder_2] => user [:db_insert_placeholder_3] => 568 [:db_insert_placeholder_4] => 1 ) in file_usage_add() (line 661 of /var/www/html/includes/file.inc).
Comment #6
trumanru CreditAttribution: trumanru commentedIt's not a problem. This function is not supported. But this issue is a feature request for this function.
After i've got your first comment I thought that you are the developer of this module.
Comment #7
omaster CreditAttribution: omaster commentedUnfortunately not the developer of this module. But this issue is vital to get working for me. So looks like will probably have to see if I can find a way to make it work if nothing done soon.
Two issues for me with this module. One the photos and two cron updates everything else works great or is not critical.
Comment #8
johnbarclay CreditAttribution: johnbarclay commentedComment #9
johnbarclay CreditAttribution: johnbarclay commentedComment #10
johnbarclay CreditAttribution: johnbarclay commentedComment #11
johnbarclay CreditAttribution: johnbarclay commentedThis is specific case of #1533492: LDAP *: Need method for dealing with binary attributes
Comment #12
trumanru CreditAttribution: trumanru commentedSorry for my persistency but this is very specific case of binary AD data. For this case target of binary data from AD must be special user data object named "Picture" wich used as file in file structure and not available as field in fields selection dialog of LDAP User module.
Comment #13
johnbarclay CreditAttribution: johnbarclay commentedSounds good. Lets keep them separate. I'm setting this to postponed as I don't see any commitment to work on it and I expect to get to it in the the 8.x version. Patches are welcome and here's how I think they should be implemented:
[property.picture] would be the token for going from drupal to ldap and the value in the ldap to drupal pulldown.
in LdapUserConf::entryToUserEdit(), add something like
if ($this->isSynched('[property.picture]', $prov_events, $direction) && !isset($edit['name'])) {
// 1) get image from ldap
// 2) insert image into drupal
// 3) and associate with the user object.
//some code to borrow from:
//user_validate_picture() // http://api.drupal.org/api/drupal/modules%21user%21user.module/function/u...
// user_save() http://api.drupal.org/api/drupal/modules%21user%21user.module/function/u...
//
}
Comment #14
vgalindus CreditAttribution: vgalindus commentedHi All I have written a fast patch to allow thumbnailPicture to sync with user thumbnail. This patch applies to beta3 release, please be aware that it is only tested against my current configuration (LDAP). It is up to you using it or not. When I have time I will try to clean up the code and write some tests as well as commit patch to queue in dev branch.
Best regards.
Comment #15
vgalindus CreditAttribution: vgalindus commentedSorry I moved to beta3, fixing.
Comment #16
omaster CreditAttribution: omaster commentedI just tested it and success it works. You can also sync jpegphoto with it which is great.
What would be good now is to get it into dev so it goes with future versions but thankyou soo much for it. :)
Comment #17
johnbarclay CreditAttribution: johnbarclay commentedThe approach looks good to me as it treats the thumbnail as the unique field that it is. Appreciate the offer to clean it up and add some tests; that will make sure it doesn't break down the line.
Comment #18
omaster CreditAttribution: omaster commentedOk I have found one issue still but I assume it is not really related to this and may get solved by this
http://drupal.org/node/1787970 and vice versa their issues can be solved by this module. now we just need them both at dev level to work.
Comment #19
omaster CreditAttribution: omaster commentedI have moved this onto the dev environment and got it working. Attached is a patch for the dev environment. Sorry it is a little messy inside. But it should do the trick.
--Edit it worked for a short time then started to fail. Not sure why. Maybe missed something.
Comment #20
omaster CreditAttribution: omaster commentedOk there is something wrong with it now both beta and dev. Need to look into it more.
Basicly though the end result is you get an error log 'Some error happened during thumbnailPhoto sync" which also then screws up the log viewer in Drupal so you have to go to the database to find it.
--edit it appears to be only if you edit a user account then try and resync the image. It only affects specific users. It would be great to know how to correct this for those users.
Comment #21
omaster CreditAttribution: omaster commentedNew patch with a corrected watchdog error for 7.x-2.x-dev, and cleaned up so it is much easier to comprehend.
Comment #22
vgalindus CreditAttribution: vgalindus commentedHi, I will take a look when I have some time to write unit tests and check this. In my env users are not allowed to change profile so I didn't realized about.
Comment #23
vgalindus CreditAttribution: vgalindus commentedHi omaster, i tried updating the thumb. It result in default thumb displayed and no resync happened after login again, is the same for you?
Br
Comment #24
johnbarclay CreditAttribution: johnbarclay commentedI committed 21 with a number of small changes:
filter = strtolower(filter);
Was unclear why this was added in.userPictureFromLdapEntry() function
. Since it can be derived from the ldap entry in a number of ways, it isn't correct to useldap_entry[this->user_attr][0]
Please test.
Comment #25
omaster CreditAttribution: omaster commentedExcellent. Will test today.
Galindus - Yes that is what I am getting also.
Comment #26
omaster CreditAttribution: omaster commentedTesting went well. So far nothing but the aforementioned problem.
Comment #27
johnbarclay CreditAttribution: johnbarclay commentedfor the simpletests I have ldap images in the following format:
What format(s) should be in the ldap php array for the simpletest? That is what formats would you expect the ldap php array?
If you can just post examples that would help with the simpletests.
Comment #28
vgalindus CreditAttribution: vgalindus commentedI have this kind too
BR
Comment #29
trumanru CreditAttribution: trumanru commentedI don't beleive my eyes! It's really works!
Guys, you saved my day!
No, no.... More than a one day! You saved my MONTH!
The next question is: does it work with LDAP Feeds module?
I have a phonebook directory on corporative portal with all users from Active Directory and it would be good to have all user's photos. Not only photos of users who have logged in portal but all of them.
Comment #30
omaster CreditAttribution: omaster commentedIt sounds more like cron functionality which is what I am looking for would be good. If the user data can update via cron then I am all set.
Comment #31
vgalindus CreditAttribution: vgalindus commentedHi All, I've been working a bit more on this. Now you can set the same options as for email attr under authentication form. I think update process has been improved but needs some test. Updated to last dev release. To work is required to apply this patch http://drupal.org/node/1787970
Not sure about cron functionality, if it is already there it should work.
BR
Comment #32
johnbarclay CreditAttribution: johnbarclay commentedThanks. Seems like a useful direction especially with the clear explanation of the options.
This should go into ldap_user and ldap_server module, not ldap_authentication. Ideally as field in the ldap_user provisioning grid/table/mapping. If it can't fit into that format because of the unique nature of profile images, the provisioning part should go in ldap_user with things like update options and anything specific to the ldap_server such as the attribute holding the image should go in ldap_server.
@galindus_olidop can you start another issue as a feature request for the additional options. That way we can close this one out when the images themselves are working correctly.
Comment #33
trumanru CreditAttribution: trumanru commentedThumbnails import from AD works good thru LDAP Feeds.
But after installed last dev release (2013-02-28) i've some problems.
First.
SSO doesn't work. I cant distinguish the source of this problems till now. Perhaps it's depended on other changes.
Second.
After login thru form on user/login page ordinary users see error messages:
As I see in this error message, the function which have a problem is userPictureFromLdapEntry().
Comment #34
johnbarclay CreditAttribution: johnbarclay commentedsso may be related to:[#892368]
Comment #35
johnbarclay CreditAttribution: johnbarclay commented@#33. I fixed the obvious issue with userPictureFromLdapEntry and committed it. http://drupalcode.org/project/ldap.git/commitdiff/f0c1a07ae2cf18ff1f7cb2... and the one after that. Please keep testing and thanks for the quick fixes.
Comment #36
trumanru CreditAttribution: trumanru commentedI reverted my site's ldap installation to LDAP module 7.x-2.x-dev version 2013-02-26.
Only this version can imports thumbnailPhoto AD field via LDAP Feeds. Versions 2013-02-28 and 2013-03-11 don't do it.
Comment #37
trumanru CreditAttribution: trumanru commented7.x-2.x-dev still doesn't work with LDAP Feeds but 7.x-2.x-dev version 2013-02-26 worked fine.
Comment #38
trumanru CreditAttribution: trumanru commentedProvisioning during user logon works fine but LDAP Feeds still doesn't load thumbnailPicture to user profile. As I said before 7.x-2.x-dev version 2013-02-26 did it.
I've made this process many times:
1. install new dev version
2. check loading thumbnails via LDAP Feeds = unsuccessfull
3. remove new version
4. setup version 2013-02-26
5. checking LDAP Feeds = successfully loaded thumbnailPictures
Comment #39
johnbarclay CreditAttribution: johnbarclay commentedLets start one issue for feeds issues and one for ldap user. This issue is all over the place.