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

LDAP Sync users moodle_exception thrown invalidusername

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.6.1
    • Fix Version/s: None
    • Component/s: Authentication
    • Labels:
      None
    • Affected Branches:
      MOODLE_26_STABLE

      Description

      Problematic because when the moodle exception is thrown, all synchronization is abandoned and no records are synchronized. So 1 error causes script to abandon all synchronization (8,000 valid user accounts) when running auth\ldap\cli\sync_users.php.

      username triggering error was: "test associate"

      Appears the space character in the username triggered the exception.

      Not an issue with Moodle version 2.5

      Discussion of this problem was located in the following forum posts: https://moodle.org/mod/forum/discuss.php?d=244011

      Gives the following results in 2.6.1+
      -------------------------------------------

      !!! The given username contains invalid characters !!!
      !!
      Error code: invalidusername !!
      !! Stack trace: * line 48 of \user\lib.php: moodle_exception thrown

      • line 948 of \auth\ldap\auth.php: call to user_create_user()
      • line 63 of \auth\ldap\cli\sync_users.php: call to auth_plugin_ldap->sync_users()
        !!

      -------------------------------------------
      Temporary Workaround - comment out line 48 of user/lib.php as suggested in the forum.

      //throw new moodle_exception('invalidusername');

      This bypasses the checking, but puts us at risk of trying to create users with truly invalid usernames.

      Thanks

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: