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

Matrix integration MVP - Matrix is available for use in courses

XMLWordPrintable

    • MOODLE_402_STABLE
    • MOODLE_403_STABLE
    • MDL-77576-master-mvp
    • Hide

      Initial setup for testing

      Setup the environment using the following link: https://github.com/mattporritt/moodle-docker
      (Feel free to reach out for any issues)

      Make sure you have access to the following information (details are in the docker readme):

      • Element server URL (https://element:8081)
      • Access token, generated using the same account used to login to element client. Refer to the Docker readme to generate one
      • Synapse server URL (https://synapse:8008)
      • Refresh token (optional: you can use access token at this point here)
      • Add the following port in the curlsecurityallowedport (admin/settings.php?section=httpsecurity):
        8008

      Test scenarios

      Test scenario 1: Experimental feature

      1. Navigate to Site Administration > Development.
      2. Click on Experimental settings.
      3. Confirm that you will see a setting called Enable communications subsystems.
      4. Confirm that the default value is unchecked (No).
      5. Navigate to Site Administration > Plugins.
      6. Confirm that you will not see the Communication section.
      7. Confirm that you will not see the Manage communication providers.
      8. Navigate to Site Administration > Development.
      9. Click on Experimental settings.
      10. Turn on (checked) Enable communications subsystems setting.
      11. Click on Save changes.
      12. Navigate to Site Administration > Plugins.
      13. Confirm that you will see the Communication section.
      14. Confirm that you will see the Manage communication providers.
      15. Click on the Manage communication providers link.
      16. Confirm that you will see the Manage communication providers page.
      17. Confirm that you will see Matrix.

      Test scenario 2: Matrix plugin settings page

      1. Navigate to Site Administration > Development.
      2. Click on Experimental settings.
      3. Confirm that you will see a setting called Enable communications subsystems.
      4. Confirm that the default value is unchecked (No).
      5. Enable the setting.
      6. Navigate to Site Administration > Plugins.
      7. Confirm that you will see the Communication section.
      8. Confirm that you will see the Manage communication providers.
      9. Click on the Manage communication providers link.
      10. Confirm that you will see the Manage communication providers page.
      11. Confirm that you will see Matrix.
      12. Confirm that you can enable/disable the Matrix plugin by clicking on the "eye" icon.
      13. Click on the Settings link of Matrix plugin.
      14. Confirm that you will see the settings page for the Matrix plugin.
      15. Navigate back to the Manage communication providers page.
      16. Confirm that you can not uninstall the plugin.
      17. Navigate back to the Matrix settings page.
      18. Confirm the following fields are required and can not save changes without them:
        1. Home server URL
        2. Access token 
        3. Refresh token
        4. Element web URL 
      19. Confirm the following fields are password masked:
        1. Access token 
        2. Refresh token
      20. Add the information in all the fields.
      21. Click save changes.
      22. Confirm the fields are saved properly.

      Test scenario 3: Create room

      1. Navigate to the Moodle instance.
      2. Navigate to Site admin > Development > Experimental settings and enable 'Enable communication subsystem'
      3. Navigate to Site admin > Plugins > Communication > Matrix > Settings
      4. Add the synapse server url (available from the environment setup)
      5. Add the access token (available from the environment setup)
      6. Add the refresh token if available, otherwise paste the access token
      7. Add the element server url (available from the environment setup)
      8. Navigate to the create a new course form
      9. Add all the required information in form
      10. Upload a course image
      11. Go to the communication section
      12. Select Matrix as Communication Service
      13. Leave the Room name blank
      14. Save changes
      15. Run the ad-hoc task or the cron itself: php admin/cli/cron.php
      16. Navigate to the element client
      17. Confirm a new room exists whose name matches the course name that was set in the course admin settings
      18. Confirm the new room has the avatar set same as the course image

      Test scenario 4: Update room

      1. Navigate to the Moodle instance.
      2. Edit the newly created course
      3. Upload a new course image
      4. Go to the communication section
      5. Confirm Matrix is selected as provider
      6. Change the name of the provider room
      7. Save changes
      8. Run the ad-hoc task or the cron itself: php admin/cli/cron.php
      9. Navigate to the element client
      10. Confirm a new room exists whose name matches the room name that was set in the course admin settings
      11. Confirm the new room has the avatar set same as the course image

      Test scenario 5: Enroll user

      1. Go to a created course
      2. Go to Participants and click on "Enrol Users" and add some users
      3. Set the "Assign role" to "Student" then press "Enrol users"
      4. Run the ad-hoc task or the cron itself: php admin/cli/cron.php
      5. Go to https://element:8081
      6. Choose the room that was just created for this course
      7. Confirm there is a notification within the matrix room that the user has been removed, and confirm the user can no longer access the room via the course homepage
      8. Confirm that new students have been added to the room. If you are having trouble accessing the Matrix room as a student, log into Matrix as the Admin and navigate to the room. You should see 'User X joined the room', etc.

      Test scenario 6: Unenroll user

      1. Go back to the created course
      2. Go to Participants and click on "Trash icon" to unenrol a user from the course
      3. When the popup is shown, click on "Unenrol"
      4. Run the ad-hoc task or the cron itself: php admin/cli/cron.php
      5. Go to https://element:8081
      6. Click on the room where the users were removed
      7. Confirm that the targeted users have been removed from the room

      Test scenario 7: Disabling the communication provider

      1. Go back to the created course
      2. Make sure you have a couple of users enrolled in your course
      3. Make sure they are members of a Matrix room by either observing the feed in your room as an Admin, or by checking individual access as a student.
      4. Edit your course settings and go to the 'Communication' section
      5. Set 'Provider' to 'None'
      6. Save changes
      7. Run the ad-hoc task or the cron itself: php admin/cli/cron.php
      8. Confirm that the students have lost access to the room, but the admin still has access.
      9. Edit the course settings again and change the provider back to 'Matrix'
      10. Save changes
      11. Run the ad-hoc task or the cron itself: php admin/cli/cron.php
      12. Confirm that the students have regained access to the room.

      Test scenario 8: Disabling enrollment method

      1. Make sure you have a course with some users who have access to a Matrix room still.
      2. Go back to the created course
      3. Click on 'Participants'
      4. Choose 'Enrolment methods' from the dropdown.
      5. Click the 'eye' icon next to 'Manual enrolments'
      6. Run the ad-hoc task or the cron itself: php admin/cli/cron.php
      7. Confirm that the students have lost access to the room, but the admin still has access.
      8. Re-enable the enrolment method by clicking the 'eye' icon again.
      9. Run the ad-hoc task or the cron itself: php admin/cli/cron.php
      10. Confirm that the students have regained access to the room.

      Test scenario 9: Suspending a user enrollment

      1. Make sure you have a course with some users who have access to a Matrix room still.
      2. Go back to the created course
      3. Click on 'Participants'
      4. Click the 'cog' icon next to one of the students
      5. Choose 'Suspended' from the Status drop-down and click 'Save changes'.
      6. Run the ad-hoc task or the cron itself: php admin/cli/cron.php
      7. Confirm that the student has lost access to the room.
      8. Undo the enrollment suspension by clicking the 'cog' icon again and choosing 'Active'. Click 'Save changes'.
      9. Run the ad-hoc task or the cron itself: php admin/cli/cron.php{}
      10. Confirm that the student has regained access to the room.

      Test scenario 10: Deleting a user enrollment

      1. Make sure you have a course with some users who have access to a Matrix room still.
      2. Go back to the created course
      3. Click on 'Participants'
      4. Click the 'trash can' icon next to one of the students
      5. Confirm by clicking 'Unenroll'
      6. Run the ad-hoc task or the cron itself: php admin/cli/cron.php
      7. Confirm that the student has lost access to the room.

      Test scenario 11: Suspending a user account

      1. Make sure you have a course with some users who have access to a Matrix room still.
      2. Navigate to Site admin->Browse list of users
      3. Suspend/disable one of the students account by clicking the 'eye' icon
      4. Run the ad-hoc task or the cron itself: php admin/cli/cron.php
      5. Confirm that the student has lost access to the room.
      6. Re-enable the student account by clicking the 'eye' icon again.
      7. Run the ad-hoc task or the cron itself: php admin/cli/cron.php
      8. Confirm that the student has regained access to the room.

      Test scenario 12: Deleting a user account

      1. Make sure you have a course with some users who have access to a Matrix room still.
      2. Navigate to Site admin->Browse list of users
      3. Delete one of the students account by clicking the 'trash can' icon
      4. Run the ad-hoc task or the cron itself: php admin/cli/cron.php
      5. Confirm that the student has lost access to the room.

      Test scenario 13:  Deleting an enrollment method

      1. Make sure you have a course with some users who have access to a Matrix room still.
      2. Go back to the created course
      3. Click on 'Participants'
      4. Choose 'Enrollment methods' from the drop-down.
      5. Click the 'trash can' icon next to 'Manual enrollments'
      6. Run the ad-hoc task or the cron itself: php admin/cli/cron.php
      7. Confirm that the students have lost access to the room, but the admin still has access.

      Test scenario for unit testing

      1. Run the command "docker exec -it <webserver_container_id> bash
      2. Initialise phpunit php admin/tool/phpunit/cli/init.php   
      3. Run the following testsuite: vendor/bin/phpunit --testsuite communication_matrix_testsuite
      4. Confirm the tests ran successfully
      5. Run the following testsuite: vendor/bin/phpunit --testsuite core_communication_testsuite
      6. Confirm the tests ran successfully

      Test scenario for behat testing

      1. Run the command "docker exec -it <webserver_container_id> bash
      2. Initialise behat php admin/tool/behat/cli/init.php
      3. Run the following tag: @communication
      4. Confirm the tests ran successfully

       

      Show
      Initial setup for testing Setup the environment using the following link: https://github.com/mattporritt/moodle-docker (Feel free to reach out for any issues) Make sure you have access to the following information (details are in the docker readme): Element server URL ( https://element:8081 ) Access token, generated using the same account used to login to element client. Refer to the Docker readme to generate one Synapse server URL ( https://synapse:8008 ) Refresh token (optional: you can use access token at this point here) Add the following port in the curlsecurityallowedport (admin/settings.php?section=httpsecurity): 8008 Test scenarios Test scenario 1: Experimental feature Navigate to Site Administration > Development. Click on Experimental settings. Confirm that you will see a setting called Enable communications subsystems. Confirm that the default value is unchecked (No). Navigate to Site Administration > Plugins. Confirm that you will not see the Communication section. Confirm that you will not see the Manage communication providers. Navigate to Site Administration > Development. Click on Experimental settings. Turn on (checked) Enable communications subsystems setting. Click on Save changes. Navigate to Site Administration > Plugins. Confirm that you will see the Communication section. Confirm that you will see the Manage communication providers. Click on the Manage communication providers link. Confirm that you will see the Manage communication providers page. Confirm that you will see Matrix. Test scenario 2: Matrix plugin settings page Navigate to Site Administration > Development. Click on Experimental settings. Confirm that you will see a setting called Enable communications subsystems. Confirm that the default value is unchecked (No). Enable the setting. Navigate to Site Administration > Plugins. Confirm that you will see the Communication section. Confirm that you will see the Manage communication providers. Click on the Manage communication providers link. Confirm that you will see the Manage communication providers page. Confirm that you will see Matrix. Confirm that you can enable/disable the Matrix plugin by clicking on the "eye" icon. Click on the Settings link of Matrix plugin. Confirm that you will see the settings page for the Matrix plugin. Navigate back to the Manage communication providers page. Confirm that you can not uninstall the plugin. Navigate back to the Matrix settings page. Confirm the following fields are required and can not save changes without them: Home server URL Access token  Refresh token Element web URL  Confirm the following fields are password masked: Access token  Refresh token Add the information in all the fields. Click save changes. Confirm the fields are saved properly. Test scenario 3: Create room Navigate to the Moodle instance. Navigate to Site admin > Development > Experimental settings and enable 'Enable communication subsystem' Navigate to Site admin > Plugins > Communication > Matrix > Settings Add the synapse server url (available from the environment setup) Add the access token (available from the environment setup) Add the refresh token if available, otherwise paste the access token Add the element server url (available from the environment setup) Navigate to the create a new course form Add all the required information in form Upload a course image Go to the communication section Select Matrix as Communication Service Leave the Room name blank Save changes Run the ad-hoc task or the cron itself: php admin/cli/cron.php Navigate to the element client Confirm a new room exists whose name matches the course name that was set in the course admin settings Confirm the new room has the avatar set same as the course image Test scenario 4: Update room Navigate to the Moodle instance. Edit the newly created course Upload a new course image Go to the communication section Confirm Matrix is selected as provider Change the name of the provider room Save changes Run the ad-hoc task or the cron itself: php admin/cli/cron.php Navigate to the element client Confirm a new room exists whose name matches the room name that was set in the course admin settings Confirm the new room has the avatar set same as the course image Test scenario 5: Enroll user Go to a created course Go to Participants and click on "Enrol Users" and add some users Set the "Assign role" to "Student" then press "Enrol users" Run the ad-hoc task or the cron itself: php admin/cli/cron.php Go to https://element:8081 Choose the room that was just created for this course Confirm there is a notification within the matrix room that the user has been removed, and confirm the user can no longer access the room via the course homepage Confirm that new students have been added to the room. If you are having trouble accessing the Matrix room as a student, log into Matrix as the Admin and navigate to the room. You should see 'User X joined the room', etc. Test scenario 6: Unenroll user Go back to the created course Go to Participants and click on "Trash icon" to unenrol a user from the course When the popup is shown, click on "Unenrol" Run the ad-hoc task or the cron itself: php admin/cli/cron.php Go to https://element:8081 Click on the room where the users were removed Confirm that the targeted users have been removed from the room Test scenario 7: Disabling the communication provider Go back to the created course Make sure you have a couple of users enrolled in your course Make sure they are members of a Matrix room by either observing the feed in your room as an Admin, or by checking individual access as a student. Edit your course settings and go to the 'Communication' section Set 'Provider' to 'None' Save changes Run the ad-hoc task or the cron itself: php admin/cli/cron.php Confirm that the students have lost access to the room, but the admin still has access. Edit the course settings again and change the provider back to 'Matrix' Save changes Run the ad-hoc task or the cron itself: php admin/cli/cron.php Confirm that the students have regained access to the room. Test scenario 8: Disabling enrollment method Make sure you have a course with some users who have access to a Matrix room still. Go back to the created course Click on 'Participants' Choose 'Enrolment methods' from the dropdown. Click the 'eye' icon next to 'Manual enrolments' Run the ad-hoc task or the cron itself: php admin/cli/cron.php Confirm that the students have lost access to the room, but the admin still has access. Re-enable the enrolment method by clicking the 'eye' icon again. Run the ad-hoc task or the cron itself: php admin/cli/cron.php Confirm that the students have regained access to the room. Test scenario 9: Suspending a user enrollment Make sure you have a course with some users who have access to a Matrix room still. Go back to the created course Click on 'Participants' Click the 'cog' icon next to one of the students Choose 'Suspended' from the Status drop-down and click 'Save changes'. Run the ad-hoc task or the cron itself: php admin/cli/cron.php Confirm that the student has lost access to the room. Undo the enrollment suspension by clicking the 'cog' icon again and choosing 'Active'. Click 'Save changes'. Run the ad-hoc task or the cron itself: php admin/cli/cron.php { } Confirm that the student has regained access to the room. Test scenario 10: Deleting a user enrollment Make sure you have a course with some users who have access to a Matrix room still. Go back to the created course Click on 'Participants' Click the 'trash can' icon next to one of the students Confirm by clicking 'Unenroll' Run the ad-hoc task or the cron itself: php admin/cli/cron.php Confirm that the student has lost access to the room. Test scenario 11: Suspending a user account Make sure you have a course with some users who have access to a Matrix room still. Navigate to Site admin->Browse list of users Suspend/disable one of the students account by clicking the 'eye' icon Run the ad-hoc task or the cron itself: php admin/cli/cron.php Confirm that the student has lost access to the room. Re-enable the student account by clicking the 'eye' icon again. Run the ad-hoc task or the cron itself: php admin/cli/cron.php Confirm that the student has regained access to the room. Test scenario 12: Deleting a user account Make sure you have a course with some users who have access to a Matrix room still. Navigate to Site admin->Browse list of users Delete one of the students account by clicking the 'trash can' icon Run the ad-hoc task or the cron itself: php admin/cli/cron.php Confirm that the student has lost access to the room. Test scenario 13:  Deleting an enrollment method Make sure you have a course with some users who have access to a Matrix room still. Go back to the created course Click on 'Participants' Choose 'Enrollment methods' from the drop-down. Click the 'trash can' icon next to 'Manual enrollments' Run the ad-hoc task or the cron itself: php admin/cli/cron.php Confirm that the students have lost access to the room, but the admin still has access. Test scenario for unit testing Run the command "docker exec -it <webserver_container_id> bash Initialise phpunit php admin/tool/phpunit/cli/init.php    Run the following testsuite: vendor/bin/phpunit --testsuite communication_matrix_testsuite Confirm the tests ran successfully Run the following testsuite: vendor/bin/phpunit --testsuite core_communication_testsuite Confirm the tests ran successfully Test scenario for behat testing Run the command "docker exec -it <webserver_container_id> bash Initialise behat php admin/tool/behat/cli/init.php Run the following tag: @communication Confirm the tests ran successfully  
    • 10
    • Team Hedgehog Sprint 2.2, Team Hedgehog 2023 Sprint 1.3, Team Hedgehog 2023 Sprint 1.4, Team Hedgehog 2023 Sprint 2.0

      This issue combines multiple other critical issues to provide the minimum functionality required for Matrix to be used in Moodle LMS. There are other additions which are considered "must have" for the initial release, however anything which does not prevent the functionality working has been left separate and will be marked as blocked by this issue.

      The key requirements for this issue are:

      1. A new communication subsystem and plugin type, which will house a Matrix (Synapse) plugin (and in future will include others).
      2. The Matrix (Synapse) communication plugin.
      3. The functionality should be behind an experimental feature flag.
      4. The ability to enable/create Matrix rooms from course settings.
      5. Automatic Matrix room membership addition/removal based on course enrolment.
      6. A hidden user profile field to manage users' Matrix IDs, and on-demand (just in time) creation of any users who do not yet have a Matrix ID when they need to be added to a course's Matrix room.
      7. A UI element with in a course to link users to the Matrix room when it is enabled and they have access to it.

      Further details on each of these is included in the linked MDLs.

      User stories

      The following are high level user stories for this issue:

      Student

      • As a student I want to be able to join the matrix chat for my course from the main course page in Moodle. So I can communicate with the peers in my course and ask my teacher questions.
      • As a student I want to be able to join the matrix chat for my course from any Moodle activity main page. So I can communicate with the peers in my course and ask my teacher questions.
      • As a student I want to be able to contact one of my peers using matrix from their user profile page in Moodle. So I can chat directly to them.
      • As a Student I want the Moodle course name included in Matrix chat room name so I know which chat in Matrix relates to which of my courses.

      Teacher

      • As a teacher I want to be able to join the matrix chat for my course from the main course page in Moodle. So I can communicate with my students.
      • As a teacher I want to be able to join the matrix chat for my course from any Moodle activity main page. So I can communicate with my students.
      • As a teacher I want to be able to contact one of my peers using matrix from their user profile page in Moodle. So I can chat directly to them.
      • As a teacher I want to be able to enable or disable Matrix integration for my course from the general course settings. When enabled I expect a “room” in matrix to be created asynchronously in the “background” for my course and students in my course with active enrolments to be invited to that room. So I can control how my students communicate in my course.
      • As a teacher I want to be able to set the Matrix room name for my course in the general course settings in Moodle. With a sensible name set by default. So I can customise the experience for my students.
      • As a teacher I want students invited and removed from my courses room in Matrix based on their enrolment status in my Moodle course. Where an active enrollment means they are in the room, and a suspended or not enrolled status meaning they are not in the room. So that only students with active enrolments can participate.
      • As a teacher when I explicitly configure a matrix chat room from my Moodle course, I don’t want to be blocked from other actions while the chat room is being created for me in the background.

      Admin

      • As an admin I expect that matrix chat rooms for existing courses are not enabled by default when I upgrade to Moodle 4.2. So not to confuse the teachers at my organisation.
      • As an admin I want to be able to enter the details of my organisation's homeserver, including the administration user details. So my Moodle can connect to my organisation's Matrix server.
      • As an admin I want to be able to configure Moodle to create users in Matrix for my users in Moodle. So my Moodle users can connect to my organisation’s Matrix instance.
      • As an admin I want to be able to map an existing user profile field to a Matrix unique identifier. So that when a user in Moodle performs a matrix related action they are correctly identified in Matrix.
      • As an admin I want to be able to enable or disable the Matrix chat functionality via the Moodle LMS settings (subsystem). So I can control and evaluate how my organisation has access to this functionality.

      Developer

      • As a Moodle developer I want a Moodle subsystem that supports plugins with a suitable API so that I can write plugins that integrate with various chat systems like Matrix.

        1. behat.png
          behat.png
          153 kB
        2. matrix_001.png
          matrix_001.png
          78 kB
        3. matrix_002.png
          matrix_002.png
          80 kB
        4. phpunit.png
          phpunit.png
          122 kB
        5. scenario_1.png
          scenario_1.png
          139 kB
        6. scenario_2.png
          scenario_2.png
          68 kB
        7. scenario_3.png
          scenario_3.png
          127 kB
        8. test1_1.png
          test1_1.png
          97 kB
        9. test1_2.png
          test1_2.png
          27 kB
        10. test10_1.png
          test10_1.png
          162 kB
        11. test11_1.png
          test11_1.png
          169 kB
        12. test11_2.png
          test11_2.png
          165 kB
        13. test12_1.png
          test12_1.png
          286 kB
        14. test13_1.png
          test13_1.png
          295 kB
        15. test2_1.png
          test2_1.png
          224 kB
        16. test2_2.png
          test2_2.png
          192 kB
        17. test3_1.png
          test3_1.png
          121 kB
        18. test4_1.png
          test4_1.png
          38 kB
        19. test5_1.png
          test5_1.png
          121 kB
        20. test6_1.png
          test6_1.png
          110 kB
        21. test7_1.png
          test7_1.png
          131 kB
        22. test7_2.png
          test7_2.png
          158 kB
        23. test8_1.png
          test8_1.png
          150 kB
        24. test8_2.png
          test8_2.png
          152 kB
        25. test9_1.png
          test9_1.png
          155 kB
        26. test9_2.png
          test9_2.png
          157 kB

            safat.shahin@moodle.com Safat Shahin
            michaelh Michael Hawkins
            Safat Shahin Safat Shahin
            Andrew Lyons Andrew Lyons
            Huong Nguyen Huong Nguyen
            Votes:
            1 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 week, 2 days, 3 hours, 45 minutes
                1w 2d 3h 45m

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