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

LDAP Sync users moodle_exception thrown invalidusername

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 2.6.1
    • Authentication
    • None
    • MOODLE_26_STABLE

      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

            Unassigned Unassigned
            maysa Scott May
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

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