Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-24666

sync_users.php does not add new users

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • 2.0.4, 2.1.1
    • 2.0, 2.1, 2.2
    • Authentication
    • None
    • LAMP and MS Active Directory
    • MySQL
    • MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • MOODLE_20_STABLE, MOODLE_21_STABLE
    • wip_MDL-24666_HEAD_sync_users.php
    • Easy
    • Hide

      Either setup a 1.9 Moodle site with LDAP authentication and configure a mixed case LDAP user attribute setting (e.g. sAMAccountName for MS Active Directory), then upgrade to Moodle 2.x and then run /auth/ldap/cli/sync_users.php (make sure you have 2+ moodle users in your LDAP server), or directly setup a 2.x Moodle site with LDAP authentication and modify the setting in the database to make it mixed case, then run /auth/ldap/cli/sync_users.php.

      Show
      Either setup a 1.9 Moodle site with LDAP authentication and configure a mixed case LDAP user attribute setting (e.g. sAMAccountName for MS Active Directory), then upgrade to Moodle 2.x and then run /auth/ldap/cli/sync_users.php (make sure you have 2+ moodle users in your LDAP server), or directly setup a 2.x Moodle site with LDAP authentication and modify the setting in the database to make it mixed case, then run /auth/ldap/cli/sync_users.php.

      The "sync_users.php" script updates users fine, but it doesn't add new users via LDAP from AD.
      Here's the scripts error message (i only changed Name and E-Mail):
      ----------
      Database transaction aborted automatically in /var/www/moodle/web/auth/ldap/cli/sync_users.php
      Default exception handler: Error writing to database Debug: Duplicate entry '1-' for key 'user_mneuse_uix'
      INSERT INTO user (firstname,lastname,email,idnumber,department,confirmed,auth,mnethostid,username,lang) VALUES(?,?,?,?,?,?,?,?,?,?)
      [array (
      0 => 'Nils',
      1 => 'Holgerson',
      2 => 'Nils.Holgerson@uni-wh.de',
      3 => '54129',
      4 => '2010/10/13',
      5 => 1,
      6 => 'ldap',
      7 => '1',
      8 => '',
      9 => 'en',
      )]

      • line 394 of /lib/dml/moodle_database.php: dml_write_exception thrown
      • line 816 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      • line 858 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
      • line 852 of /auth/ldap/auth.php: call to mysqli_native_moodle_database->insert_record()
      • line 65 of /auth/ldap/cli/sync_users.php: call to auth_plugin_ldap->sync_users()

      Potential coding error - existing temptables found when disposing database. Must be dropped!
      ----------

      As you can see the field "8" (username) is empty which probably leads to this error. It is mapped against sAMAccountName in AD. This mapping is working in updating users but not in creating new in the Moolde DB.

      Thanks for your help in advance!

            iarenaza Iñaki Arenaza
            mediamarc Marc Malik (Inactive)
            Sam Hemelryk Sam Hemelryk
            Aparup Banerjee Aparup Banerjee
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.