/** * Specific to PARIS 5 * Uppdate the use information and his subsciprion to session * via ldap * param login : the user login **/ function ldap_update_user($login) { $uinfo = ldap_find_user_info($login); ldap_put_user_info_locally($login, $uinfo); }
/** * Users trying to login, who do not yet exist in the Chamilo database, * can be added by this script which tries to retrieve ldap information * about them. * @author Roan Embrechts * @package chamilo.auth.ldap */ /** * when a user does not exist yet in dokeos, * but he or she does exist in the LDAP, * we add him to the dokeos database */ //require_once('../../inc/global.inc.php'); - this script should be loaded by the /index.php script anyway, so global is already loaded require_once 'authldap.php'; //error_log('Trying to register new user '.$login.' with pass '.$password,0); $ldap_login_success = ldap_login($login, $password); if ($ldap_login_success) { //error_log('Found user '.$login.' on LDAP server',0); /* In here, we know that - the user does not exist in dokeos - the users login and password are correct */ $info_array = ldap_find_user_info($login); ldap_put_user_info_locally($login, $info_array); } else { //error_log('Could not find '.$login.' on LDAP server',0); $loginFailed = true; unset($_user['user_id']); $uidReset = false; }
$errors[] = lang("ACCOUNT_USER_OR_PASS_INVALID"); } if ($res == -1) { $errors[] = lang("ACCOUNT_USER_OR_PASS_INVALID"); } if ($res == 0) { // echo "<h1>LDAP OK for $username</h1>"; if (!usernameExists($username)) { //First connexion, user needs to be added to SKEM Bank DB // After being created : // Change permision_id in sk_user_permission_matches to // 3 for admin // 2 for professor // 1 is default for students $successes[] = lang("ACCOUNT_NEW_USER_WELCOME"); $userInfo = ldap_find_user_info($username); // print_r($userInfo); //Construct a user object $username = $userInfo['username']; $displayname = $userInfo['firstname'] . " " . $userInfo['lastname']; $password = '******'; $email = $userInfo['email']; $user = new User($username, $displayname, $password, $email); //Checking this flag tells us whether there were any errors such as possible data duplication occured if (!$user->status) { if ($user->username_taken) { $errors[] = lang("ACCOUNT_USERNAME_IN_USE", array($username)); } if ($user->displayname_taken) { $errors[] = lang("ACCOUNT_DISPLAYNAME_IN_USE", array($displayname)); }