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

Error reading database on Participants page if site:accessallgroups is set to prohibit

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Ensure you are testing with MySQL
      2. Login as admin
      3. Create three users (teacher, student1, student2)
      4. Create a new course with "Group mode: Separate groups" & "Force group mode: Yes"
      5. Enrol teacher as a teacher, student1/student2 as students
      6. Create two groups (group1, group2)
      7. Add teacher/student1 to group1, add student2 to group2
      8. Visit course participants page
      9. Select "Permissions" from the "Actions menu"
      10. Select "Teacher" from the "Advanced role override" list
      11. Set the capability "moodle/site:accessallgroups" to Prohibit
      12. Log out
      13. Log in as teacher
      14. Navigate to course
      15. Press "Participants"
      16. Confirm you don't see an exception
      17. Confirm you see teacher/student1 in list of participants
      Show
      Ensure you are testing with MySQL Login as admin Create three users (teacher, student1, student2) Create a new course with "Group mode: Separate groups" & "Force group mode: Yes" Enrol teacher as a teacher, student1/student2 as students Create two groups (group1, group2) Add teacher/student1 to group1, add student2 to group2 Visit course participants page Select "Permissions" from the "Actions menu" Select "Teacher" from the "Advanced role override" list Set the capability "moodle/site:accessallgroups" to Prohibit Log out Log in as teacher Navigate to course Press "Participants" Confirm you don't see an exception Confirm you see teacher/student1 in list of participants
    • Affected Branches:
      MOODLE_310_STABLE, MOODLE_39_STABLE
    • Fixed Branches:
      MOODLE_39_STABLE
    • Pull 3.9 Branch:
    • Pull Master Branch:

      Description

      Hi there,

      I am trying to forbid teachers from seeing other participants from other groups. Courses are in force group mode and I am expecting that teachers cannot see any other students other than in their own groups.

      Fresh Moodle install version 3.9 (Build: 20200615)

      Change Teacher role site:accessallgroups to prohibit

      Any course with force group mode on all teachers getting "Error reading from database" once they click Participants button from Moodle menu. follow by redirecting teachers to the front page.

       

      Is it possible to see all participants only in the group they are enrolled in, instead of getting an error?

       

      Debug info: FUNCTION hia_moodle.0AND does not exist
      SELECT COUNT(u.id)
      FROM (SELECT DISTINCT udistinct.id
      FROM mdl_user udistinct
      JOIN mdl_user_enrolments ue ON ue.userid = udistinct.id
      JOIN mdl_enrol e ON e.id = ue.enrolid
      AND e.courseid = ?
      WHERE udistinct.deleted = 0
      ) targetusers
      JOIN mdl_user u ON u.id = targetusers.id
      JOIN (SELECT DISTINCT feu_u.id
      FROM mdl_user feu_u
      LEFT JOIN mdl_groups_members gm1_gm2
      ON (gm1_gm2.userid = feu_u.id AND gm1_gm2.groupid = ?)
      WHERE feu_u.deleted = 0AND (gm1_gm2.userid IS NOT NULL)) fef ON fef.id = u.id
      LEFT JOIN (SELECT DISTINCT eu_u.id
      FROM mdl_user eu_u
      LEFT JOIN mdl_groups_members gm2_gm2
      ON (gm2_gm2.userid = eu_u.id AND gm2_gm2.groupid = ?)
      WHERE eu_u.deleted = 0 AND ((gm2_gm2.userid IS NOT NULL))) ef ON ef.id = u.id
      LEFT JOIN mdl_user_lastaccess ul ON (ul.userid = u.id AND ul.courseid = ?)
      LEFT JOIN mdl_context ctx ON (ctx.instanceid = u.id AND ctx.contextlevel = ?)
      WHERE ef.id IS NOT NULL
      [array (
      0 => '35',
      1 => 16,
      2 => 16,
      3 => '35',
      4 => 30,
      )]
      Error code: dmlreadexception

       

      Stack trace:

      • line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown
      • line 1273 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      • line 1624 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_records_sql()
      • line 1697 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
      • line 1907 of /lib/dml/moodle_database.php: call to moodle_database->get_field_sql()
      • line 148 of /user/classes/table/participants_search.php: call to moodle_database->count_records_sql()
      • line 407 of /user/classes/table/participants.php: call to core_user\table\participants_search->get_total_participants_count()
      • line 2024 of /lib/tablelib.php: call to core_user\table\participants->query_db()
      • line 210 of /user/classes/table/participants.php: call to table_sql->out()
      • line 181 of /user/index.php: call to core_user\table\participants->out()

        Attachments

        1. 001.PNG
          001.PNG
          138 kB
        2. 002.PNG
          002.PNG
          40 kB
        3. MDL-69214.jpg
          MDL-69214.jpg
          40 kB

          Activity

            People

            Assignee:
            pholden Paul Holden
            Reporter:
            lneoj Jerry
            Peer reviewer:
            Michael Hawkins
            Integrator:
            Eloy Lafuente (stronk7)
            Tester:
            Anna Carissa Sadia
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              14/Sep/20

                Time Tracking

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