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

Communication API not storing contextid

    XMLWordPrintable

Details

    • MOODLE_403_STABLE
    • MOODLE_403_STABLE
    • MDL-79581-master
    • Hide

      Setup

      Note: Please perform this stage before upgrading, or rebasing
      If you have already rebased your branch, please check out git at an earlier time:

      git checkout `git log --oneline --grep=MDL-79581-master --format=pretty:"%h"`~1
      

      1. Set up the Matrix server using the simplified docker setup:
        https://github.com/andrewnicols/moodle-synapse
        If you have previously set this up then please:
      2. Copy the clean-matrix.php script to your moodle instance and run it from there
      3. Run the clean.sh script from the moodle-synapse directory

      Setup the Matrix server:

      1. Run the docker-compose up command from the moodle-synapse directory
      2. Wait 30 seconds
      3. Run the setup.sh from the moodle-synapse directory

      If you have not done this before see the GitHub repo for instructions on installing certificates

      Create some test data:

      1. Create a course
      2. Enrol some users in it, including:
        1. Students
        2. Teachers
        3. Editing Teachers
        4. The admin user as a Student
      3. Navigate to the course -> More menu -> Communication
      4. Create a Matrix room for it
      5. Create a second course
      6. Navigate to the course -> More menu -> Communication
      7. Configure a URL for it
      8. Run the cron to ensure that the

      Finally:

      1. Checkout the latest master code but do not run the upgrade

      Testing

      Upgrade

      1. Open your browser to https://localhost:8081
      2. Log in with user moodlebot and password password
      3. Find the matrix-linked room for the first course you created
      4. Write a new placeholder message (e.g. "Starting testing")
      5. Run the upgrade
        1. Confirm that there were no changes to the matrix room
      6. Open a connection to the database with your preferred tooling
      7. Select all rows from the mdl_communication table:

        SELECT * FROM mdl_communication;
        

        1. Confirm that both of these have a contextid value set
      8. Navigate to the matrix-linked course you created during setup
      9. Open the participants page
      10. Enrol a new Student
      11. Remove a Student
      12. Promote a student to Teacher
      13. Run cron
      14. View the Matrix room in your browser again
        1. Confirm that the new student was added
        2. Confirm that the old student was removed
        3. Confirm that the student was promoted to teacher

      Creation

      1. Open your browser to https://localhost:8081
      2. Log in with user moodlebot and password password
      3. Create a new course
      4. Ensure that a range of users (students, teachers, editing teachers, and the admin) are enrolled
      5. Navigate to the course -> More menu -> Communication
      6. Create a Matrix room for it
      7. Run cron
      8. View the Matrix room in your browser again
        1. Confirm that the new room was created
        2. Confirm that the students have no special permission
        3. Confirm that the teachers an editing teachers have a level of 51 set
        4. Confirm that the admin has a level of 90 set
        5. Confirm that the moodlebot user has a level of "Admin" set
      Show
      Setup Note: Please perform this stage before upgrading, or rebasing If you have already rebased your branch, please check out git at an earlier time: git checkout `git log --oneline --grep=MDL-79581-master --format=pretty:"%h"`~1 Set up the Matrix server using the simplified docker setup: https://github.com/andrewnicols/moodle-synapse If you have previously set this up then please: Copy the clean-matrix.php script to your moodle instance and run it from there Run the clean.sh script from the moodle-synapse directory Setup the Matrix server: Run the docker-compose up command from the moodle-synapse directory Wait 30 seconds Run the setup.sh from the moodle-synapse directory If you have not done this before see the GitHub repo for instructions on installing certificates Create some test data: Create a course Enrol some users in it, including: Students Teachers Editing Teachers The admin user as a Student Navigate to the course -> More menu -> Communication Create a Matrix room for it Create a second course Navigate to the course -> More menu -> Communication Configure a URL for it Run the cron to ensure that the Finally: Checkout the latest master code but do not run the upgrade Testing Upgrade Open your browser to https://localhost:8081 Log in with user moodlebot and password password Find the matrix-linked room for the first course you created Write a new placeholder message (e.g. "Starting testing") Run the upgrade Confirm that there were no changes to the matrix room Open a connection to the database with your preferred tooling Select all rows from the mdl_communication table: SELECT * FROM mdl_communication; Confirm that both of these have a contextid value set Navigate to the matrix-linked course you created during setup Open the participants page Enrol a new Student Remove a Student Promote a student to Teacher Run cron View the Matrix room in your browser again Confirm that the new student was added Confirm that the old student was removed Confirm that the student was promoted to teacher Creation Open your browser to https://localhost:8081 Log in with user moodlebot and password password Create a new course Ensure that a range of users (students, teachers, editing teachers, and the admin) are enrolled Navigate to the course -> More menu -> Communication Create a Matrix room for it Run cron View the Matrix room in your browser again Confirm that the new room was created Confirm that the students have no special permission Confirm that the teachers an editing teachers have a level of 51 set Confirm that the admin has a level of 90 set Confirm that the moodlebot user has a level of "Admin" set
    • 2
    • Team Hedgehog 2023 Sprint 3.3

    Description

      Discovered this whilst discussing MDL-78689.
      This is a serious flaw and must fix for 4.3.

      We need 100% to store the contextid that a communication instance relates to.

      The API was incorrectly assuming that all uses of the API were for a course, and that the instanceid of the communication instance was a course id. These assumptions are both entirely wrong.

      The API is intended to support a range of uses including use at the site, user, and activity levels.

      Furthermore, if a group were to be used, then the instanceid should be of that group's id, and therefore the contextid would need to be fetched or that group's course instead.

      The only solution here is to add a new contextid field to the table, and implement it all parts of the API.

      Attachments

        1. (1) 14 Passed -- (Master)MDL-79581.png
          87 kB
          Kim Jared Lucas
        2. (1) 5 Passed -- (Master)MDL-79581.png
          74 kB
          Kim Jared Lucas
        3. (1) 7 Passed -- (Master)MDL-79581.png
          25 kB
          Kim Jared Lucas
        4. (2) 8 Passed -- (Master)MDL-79581.png
          107 kB
          Kim Jared Lucas

        Issue Links

          Activity

            People

              dobedobedoh Andrew Lyons
              dobedobedoh Andrew Lyons
              Safat Shahin Safat Shahin
              Huong Nguyen Huong Nguyen
              Kim Jared Lucas Kim Jared Lucas
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 day, 3 hours, 7 minutes
                  1d 3h 7m

                  Clockify

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