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

sync_users.php does not add new users

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0, 2.1, 2.2
    • Fix Version/s: 2.0.4, 2.1.1
    • Component/s: Authentication
    • Labels:
      None
    • Environment:
      LAMP and MS Active Directory
    • Database:
      MySQL
    • Testing Instructions:
      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.
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      wip_MDL-24666_HEAD_sync_users.php

      Description

      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!

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  1/Aug/11