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

Moodle cannot create a new record on user table when a new LDAP entry wants to authenticate

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 1.8.5, 1.8.6, 1.8.7, 1.9, 1.9.1, 1.9.2, 1.9.3
    • Fix Version/s: 1.8.8, 1.9.4
    • Component/s: Authentication
    • Labels:
      None
    • URL:
      cvs:/lib/moodlelib.php
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE

      Description

      Environment: a new LDAP entry try to authenticate for the first time in Moodle and still there isn't a record in mdl_user table.

      When this new user try to authenticate, authenticate_user_login function is called. If the credentials are correct, it search the correct record in mdl_user table without success and it calls create_user_record.
      This function try to create a new record, but this is the error message:

      Field 'city' doesn't have a default value

      INSERT INTO mdl_user ( AUTH, CONFIRMED, MNETHOSTID, USERNAME, FIRSTNAME, LASTNAME, LANG, LASTIP, TIMEMODIFIED ) VALUES ( 'ldap', 1, 1, 'd.eliseo', 'Donato', 'Eliseo', 'it_utf8', '10.250.1.21', 1229596730 )
      line 1425 of lib/dmllib.php: call to debugging()
      line 2603 of lib/moodlelib.php: call to insert_record()
      line 2787 of lib/moodlelib.php: call to create_user_record()
      line 126 of login/form.php: call to authenticate_user_login()

      infact City Field is a nonull param as you see in cvs:/lib/db/install.xml without default value

      Solution: adding something like:
      $newuser->city = '';
      in create_user_record function in cvs:/lib/moodlelib.php

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  28/Jan/09