Hi,
I am only using ldap_auth as all my users need to do is authenticate. In order to get users into the database, I use hook_cron and import the users from AD and save them using this code:
// Insert the account
$useraccount = array(
'name' => $aduser['username'],
'pass' => user_password(20),
'mail' => $aduser['mail'],
'status' => 1,
'init' => $aduser['mail'],
'authname_ldapauth' => $name,
'ldap_authentified' => true,
'ldap_dn' => $aduser['dn'],
'ldap_config' => '1',
'roles' => array(4 => 'staff member'),
);
// Save the user
$populateduser = user_save(null, $useraccount);
This seems to work fine on the surface, my users are appearing and their content_profile's are appearing as well. Most of the users I have tested are authenticating fine, but a few are not. I'm trying to use mixed mode authentication to help debug (so I set the users a password using the /user/[x]/edit interface), but the drupal authentication just doesn't work and it makes AD bomb out and lock out the users from their accounts.
In the mixed mode authentication label it says ' Mixed mode. The LDAP authentication is performed only if Drupal authentication fails', does this mean that I should be able to set the Drupal accounts (which log into the site via ldap usually) with a drupal password in the way i described and have them authenticate with that? Or does it mean that users who authenticate with AD through ldap cannot have a 'drupal' password, but it's possible to create ordinary non-ldap users and have them authenticate with drupal in the usual way?
Thanks for your help.
Comments
Comment #1
zeezhao commentedA couple of things:
1. you can use ldapsync module to get all your users into drupal. Pull the code from here as its not in dev version: http://drupal.org/node/396574#comment-3910520
Once installed, there is a "synchronization" link which leads you to where you can do run it once via the "sync now" button.
2. In mixed mode, I usually let LDAP control password, so under the "security options" I leave "Sync LDAP password with the Drupal password" unchecked.
Mixed mode then allows you have have non-ldap users that get authenticated through drupal as normal, but ldap users always via ldap. This way I avoid confusion
Comment #2
cgmonroe commentedClearing out old support requests - reopen if problem still exists in newest code (dev)