Download & Extend

Ability to store custom attributes in LDAP

Project:LDAP provisioning
Version:6.x-1.0-beta1
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Issue tags:custom fields

Issue Summary

The ability to store the defined custom fields in: ldapprov.conf.inc into the ldap using the "Basic LDAP attributes:" template

ldapprov.module Line #1588

  //Add Support for storring the custom fields into ldap
  foreach(ldapprov_custom_elements() as $field_name => $field) {
    $ldap_vars['!'.$field_name] = $data['custom_'.$field_name];
  }

I fixed it like this for the time being but is it possible to integrate this into the module or is there some other way to do this?

Comments

#1

There is no ldapprov.conf.inc file any more in the dev version. Custom fields are configurable from the module settings page.

#2

Can someone provide a bit more detail on how to add custom fields? For backwards compatibility reasons, I need to add a custom salted password field to LDAP that users should not see or be able to edit. I need the salted password to be stored when a user gets created and updated if a user changes their password. I have a handle on getting the password and salting it the way I need it, but I'm not sure how/where I go about adding it to LDAP.

#3

Version:6.x-1.0-alpha2» 6.x-1.0-beta1

In the 6.x.-1.0-beta1 release you goto: /admin/settings/ldap/ldapprov

There you will find a fieldset: "Registration form" with "Custom elements" there you can add a custom field to the registration form:

sponsor|type=>textfield|title=>Sponsor POC|weigth=>4|size=>64|maxlemgth=>64|required=>1|description=>Sponsor Point of Contact.

And than you add the following to the "LDAP attributes"

<ldapattribute_name>: !custom_sponsor

As you can see the field called !custom_<custom name>

#4

@ Nr. 18

its not working.

ldapattribute_name: !custom_sponsor

i tried some combinations
like

ldapattribute_name: %custom_sponsor
ldapattribute_name: !sponsor
ldapattribute_name: %sponsor

although its adding in ldap server with the name itself(!custom_sponsor) ,not the exact value.

I am using drupal-6.15 with ubuntu 9.10 karmic and LDAP server is a fedora version.

#5

hmm i cant wait anymore.

finally got it working after digging the code .

in ldapprov.module after line number 1860 (don't know exactly but after this line )
$ldap_vars['!pass'] = $pass_ldap;

I added


$form_custom = variable_get('ldapprov_custom', array());
foreach ($form_custom as $custom_name=>$field)
{
$ldap_vars['!'.$custom_name] = isset($data[$custom_name]) ? $data[$custom_name] : NULL;
}

and it's working perfectly.

and rest is same as Nr. 18 said .

Note: I have tested only for only Custom elements which are defined in ldapprov registration form.
but was not working with Profile integration. lets see if someone can contribute that code

I hope the author will add this code in next version.! :-)

#6

*shrug* worked for me. Maybe you didn't realise that "ldapattribute_name" is a placeholder, and that you actually have to put, um, your attribute name. For example:

o: !custom_o