We had the following error when trying to create a user in LDAP from Drupal:
Failed to save the user to LDAP. Object class violation
The LDAP log showed the following:
May 8 21:12:00 valkyrie slapd[1055]: Entry (cn=test10,dc=local): object class 'inetOrgPerson' requires attribute 'sn'
Turns out the default OpenLDAP schema *requires* the "sn" field to be populated. now maybe we screwed up something in our config, but here's at least a module to remove the error:
/**
* @file
* Mail simple_ldap_user_sn module file.
*/
/**
* implements hook_simple_ldap_user_to_ldap_alter()
*/
function simple_ldap_user_sn_simple_ldap_user_to_ldap_alter($ldap_user, $drupal_user) {
// sn is required for inetOrgPerson
if (!isset($ldap_user->sn)) {
$ldap_user->sn = $ldap_user->dn;
}
}
name = Simple LDAP User SN override
description = Populates the SN field for the Simple LDAP user module
package = LDAP
dependencies[] = simple_ldap
core = 7.x
Comments
Comment #1
ergonlogicComment #2
anarcat commentedoops. it seems we don't actually need to code anything, this can be overriden in the settings.php, to quote the README (duh):
much simpler...