function ldap_create_drupal_account in Lightweight Directory Access Protocol (LDAP) 7
1 call to ldap_create_drupal_account()
- _ldap_authentication_user_login_authenticate_validate in ldap_authentication/
ldap_authentication.inc - user form validation will take care of username, pwd fields
File
- ldap_servers/
ldap_servers.functions.inc, line 25 - collection of functions that don't belong in server object
Code
function ldap_create_drupal_account($authname, $accountname, $mail, $dn, $sid, $status, $edit) {
$edit['name'] = $accountname;
$edit['pass'] = user_password(20);
$edit['mail'] = $mail;
$edit['init'] = $mail;
$edit['status'] = $status;
if (!isset($edit['signature'])) {
$edit['signature'] = '';
}
// save 'init' data to know the origin of the ldap authentication provisioned account
$edit['data']['ldap_authentication']['init'] = array(
'sid' => $sid,
'dn' => $dn,
'mail' => $mail,
);
if (!($account = user_save(NULL, $edit))) {
drupal_set_message(t('User account creation failed because of system problems.'), 'error');
return FALSE;
}
else {
user_set_authmaps($account, array(
'authname_ldap_authentication' => $authname,
));
}
return $account;
}