Hi,
I was trying to debug a "Naming violation" error I was getting while trying to save a new user from drupal to active directory 2013 and 2008
This is the exception in watchdog
SimpleLdapException: Naming violation in SimpleLdap::ldap_add() (line 316 of .../SimpleLdap.class.php).
Turns out that the dn value of the SimpleLdapUser class was false (from watchdog)
ldap_add($link_identifier = Resource id #443, $dn = OU=TESTOU,DC=TESTCDC,DC=local, $entry = Array ( [samaccountname] => Array ( [0] => test_test.com ) [mail] => Array ( [0] => test@test.com ) [objectclass] => Array ( [0] => user ) ) )
I noticed that the dn variable of the SimpleLdapUser class is declared as false in the contructor
protected $dn = FALSE;
I couldn't figure out where it's supposed to get set. So I did from hook_simple_ldap_user_to_ldap_alter
function MYMODULE_simple_ldap_user_to_ldap_alter($ldap_user, $drupal_user) {
$dn = $ldap_user->__get('dn');
if (empty($dn)){
$base_dn = simple_ldap_user_variable_get('simple_ldap_user_basedn');
$ldap_user->__set('dn', $base_dn);
}
}
I'm not to sure if this is the right way or why the object did not have a dn.
Thank you.
Comments
Comment #1
iamjon CreditAttribution: iamjon commentedComment #2
iamjon CreditAttribution: iamjon commentedComment #3
iamjon CreditAttribution: iamjon commentedOk I got it to work by changing the alter a bit:
I still have no idea why the dn is empty in the first place.