dokeos-auth-ldap
[ class tree: dokeos-auth-ldap ] [ index: dokeos-auth-ldap ] [ all elements ]

Source for file newUser.php

Documentation is available at newUser.php

  1. <?php # $Id: newUser.php 14965 2008-04-20 23:01:17Z yannoo $
  2. /*
  3. ==============================================================================
  4.     Dokeos - elearning and course management software
  5.     
  6.     Copyright (c) 2004 Dokeos SPRL
  7.     Copyright (c) 2003 Ghent University (UGent)
  8.     Copyright (c) 2001 Universite catholique de Louvain (UCL)
  9.     Copyright (c) Roan Embrechts
  10.     
  11.     For a full list of contributors, see "credits.txt".
  12.     The full license can be read in "license.txt".
  13.     
  14.     This program is free software; you can redistribute it and/or
  15.     modify it under the terms of the GNU General Public License
  16.     as published by the Free Software Foundation; either version 2
  17.     of the License, or (at your option) any later version.
  18.     
  19.     See the GNU General Public License for more details.
  20.     
  21.     Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
  22.     Mail: info@dokeos.com
  23. ==============================================================================
  24. */
  25. /**
  26. ==============================================================================
  27. *    Users trying to login, who do not yet exist in the Dokeos database,
  28. *    can be added by this script which tries to retrieve ldap information about
  29. *   them.
  30. *
  31. *    @author Roan Embrechts
  32. *    @package dokeos.auth.ldap
  33. ==============================================================================
  34. */
  35.     
  36. /*
  37. ==================================================
  38.     when a user does not exist yet in dokeos, 
  39.     but he or she does exist in the LDAP,
  40.     we add him to the dokeos database
  41. ==================================================
  42. */
  43. //require_once('../../inc/global.inc.php'); - this script should be loaded by the /index.php script anyway, so global is already loaded
  44. require_once('authldap.php');
  45.  
  46. //error_log('Trying to register new user '.$login.' with pass '.$password,0);
  47.  
  48. $ldap_login_success ldap_login($login$password);    
  49.  
  50. if ($ldap_login_success)
  51. {
  52.     //error_log('Found user '.$login.' on LDAP server',0);
  53.     /*
  54.         In here, we know that
  55.         - the user does not exist in dokeos
  56.         - the users login and password are correct
  57.     */
  58.     $info_array ldap_find_user_info($login);
  59.     ldap_put_user_info_locally($login$info_array);
  60. }
  61. else
  62. {
  63.     //error_log('Could not find '.$login.' on LDAP server',0);
  64.     $loginFailed true;
  65.     unset($_user['user_id']);
  66.     $uidReset false;
  67. }
  68. ?>

Documentation generated on Thu, 12 Jun 2008 14:07:32 -0500 by phpDocumentor 1.4.1