My apologies if there is a way to do this without a custom DB query and I just have not found it yet; I am looking for the ability to load a user by PUID.
Rational: By default, Drupal core supplies the ability to load a user by uid or by username, but when using LDAP, it is quite common for PUID to be the real valuable identifier. Since it is supposed to be a persistent value, it is a primary key for every LDAP->Drupal provisioned user, and can be used to load the user
Use Case: An outside system is communicating with a Drupal system (by REST, XMLRPC, etc). That system needs to report actions back to Drupal, but does not have the Drupal user information (UID), only the PUID because they are on the same LDAP. If PUID is not the same as username (which is common), then the Drupal system must look up the user by PUID to log information about the user.
I will try to cycle back and share some code/my attempt at a DB-query once I get some free time.
Comments
Comment #1
johnbarclay commentedSounds good. since puid is a field, it should use entity field query. There is a function in ldapServer class userUserEntityFromPuid($puid) that uses the query you will want. The function should go in ldap user module and propably called ldap_user_load_from_puid($puid, $sid = null) {}
In the event that no $sid is provided, it should fail unless only one ldap server is configured for ldap user. If multiple ldap servers are enabled and none is specified it should return false
Also there is an include for webservices (http://drupalcode.org/project/ldap.git/blob/043a950950018c07e8a5afa33454...) that is partially finished, leverage that for any webservices.
Comment #2
larowlanadvice provided on how to handle, no update for > 12 months, no patches - closing