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

User authentication report filter missing joins

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 4.1
    • 4.1
    • Report builder
    • MOODLE_401_STABLE
    • MOODLE_401_STABLE
    • Hide
      1. Log in as admin
      2. Create a user
      3. Create a course
      4. Enrol user in course as student
      5. Navigate to Reports in user menu
      6. Create new report from Course participants report source
        • Ensure Include default setup is unchecked
      7. In report editor add the following column:
        • Course > Course full name
      8. Add the following condition:
        • User > Authentication
      9. Set authentication condition to:
        • Is equal to: Manual accounts
        • Apply
      10. Confirm report reloads without exception
      Show
      Log in as admin Create a user Create a course Enrol user in course as student Navigate to Reports in user menu Create new report from Course participants report source Ensure Include default setup is unchecked In report editor add the following column: Course > Course full name Add the following condition: User > Authentication Set authentication condition to: Is equal to: Manual accounts Apply Confirm report reloads without exception

      Found while writing stress tests in MDL-73938

      The user authentication filter (see MDL-74453) doesn't add required joins to itself, so when you try to use it in a report that otherwise contains no user columns you get DML exceptions similar to the following:

      dmlreadexception
      Error reading from database
      File: /lib/dml/moodle_database.php
      Line: 486
      Stack trace:
       
      Unknown column 'u.auth' in 'where clause'
       
                  SELECT COUNT(1)
                    FROM (SELECT c.fullname AS c0_fullname, c.id AS c0_courseid, cctx.id AS c0_ctxid, cctx.path AS c0_ctxpath, cctx.depth AS c0_ctxdepth, cctx.contextlevel AS c0_ctxlevel, cctx.instanceid AS c0_ctxinstance, cctx.locked AS c0_ctxlocked
                            FROM mdl_course c LEFT JOIN mdl_context cctx
                                 ON cctx.contextlevel = 50
                                AND cctx.instanceid = c.id
                           WHERE c.id != ? AND (u.auth=?)
                                 
                         ) rbalias41
      [array (
        0 => '1',
        1 => 'ldap',
      )]
      Error code: dmlreadexception
      * line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown
      * line 291 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end()
      * line 1273 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->query_end()
      * line 1671 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()
      * line 1744 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
      * line 1954 of /lib/dml/moodle_database.php: call to moodle_database->get_field_sql()
      * line 170 of /reportbuilder/classes/table/base_report_table.php: call to moodle_database->count_records_sql()
      * line 341 of /reportbuilder/classes/table/custom_report_table.php: call to core_reportbuilder\table\base_report_table->query_db()
      * line 262 of /lib/table/classes/external/dynamic/get.php: call to core_reportbuilder\table\custom_report_table->out()
      * line 261 of /lib/externallib.php: call to core_table\external\dynamic\get::execute()
      * line 81 of /lib/ajax/service.php: call to external_api::call_external_function()
      

            pholden Paul Holden
            pholden Paul Holden
            David Carrillo David Carrillo
            Victor Déniz Falcón Victor Déniz Falcón
            Angelia Dela Cruz Angelia Dela Cruz
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 35 minutes
                1h 35m

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