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

Allow versioned APIs for clients in Matrix provider

    XMLWordPrintable

Details

    • MOODLE_403_STABLE
    • MOODLE_403_STABLE
    • MDL-77917-master
    • Hide

      Unit testing and Behat will test most of this. The following are a validation but for quick testing.

      Setup

      1. Clone Andrew's helper repository:

        git clone https://github.com/andrewnicols/moodle-synapse
        cd moodle-synapse
        chmod 777 *_data
        

      2. Run the docker-compose up command:

        docker compose up -d
        

      3. Wait for about 10 seconds for the first run to complete
      4. Run the setup script:

        ./setup.sh
        

      5. Copy the command it outputs
      6. Change into your Moodle directory
      7. Paste in the command, for EXAMPLE:

        cd path/to/moodle
        sed -i '/^require_once.*lib.*setup.php.*$/i require_once("/Users/nicols/git/moodlehq/synapse/moodle-config.php");' config.php
        cd -
        

      8. If you have not done so already, edit your /etc/hosts file to add:

        127.0.0.1 element.container.docker.internal element
        127.0.0.1 synapse.container.docker.internal synapse
        127.0.0.1 keycloak.container.docker.internal keycloak
        

      9. Follow the instructions at https://github.com/andrewnicols/moodle-synapse#trusting to trust the root CA that is used for this.

      Element client

      1. Run cron in the CLI:

        while :; do php admin/cli/cron.php; done
        

      2. In your browser, navigate to https://element:8081/
      3. Log in with:
        1. username: moodlebot
        2. passowrd: password

      Tests

      1. In a new tab, login to your Moodle site as admin
      2. Navigate to a course which has multiple users
      3. Edit its settings
      4. Open the "Communication" section
      5. Enable Matrix, giving it a room name and topic
      6. Wait a few seconds (should be almost instant)
      7. Open Element
        1. Confirm that the room was created
        2. Confirm that users were invited to, and joined the chat
      8. Remove some users from the moodle course
      9. Open Element
        1. Confirm that those users were removed
      10. Edit the course settings
      11. Set a course image
      12. Save changes
      13. Open Element
        1. Confirm that the room avatar was set
      Show
      Unit testing and Behat will test most of this. The following are a validation but for quick testing. Setup Clone Andrew's helper repository: git clone https://github.com/andrewnicols/moodle-synapse cd moodle-synapse chmod 777 *_data Run the docker-compose up command: docker compose up -d Wait for about 10 seconds for the first run to complete Run the setup script: ./setup.sh Copy the command it outputs Change into your Moodle directory Paste in the command, for EXAMPLE : cd path/to/moodle sed -i '/^require_once.*lib.*setup.php.*$/i require_once("/Users/nicols/git/moodlehq/synapse/moodle-config.php");' config.php cd - If you have not done so already, edit your /etc/hosts file to add: 127.0.0.1 element.container.docker.internal element 127.0.0.1 synapse.container.docker.internal synapse 127.0.0.1 keycloak.container.docker.internal keycloak Follow the instructions at https://github.com/andrewnicols/moodle-synapse#trusting to trust the root CA that is used for this. Element client Run cron in the CLI: while :; do php admin/cli/cron.php; done In your browser, navigate to https://element:8081/ Log in with: username: moodlebot passowrd: password Tests In a new tab, login to your Moodle site as admin Navigate to a course which has multiple users Edit its settings Open the "Communication" section Enable Matrix, giving it a room name and topic Wait a few seconds (should be almost instant) Open Element Confirm that the room was created Confirm that users were invited to, and joined the chat Remove some users from the moodle course Open Element Confirm that those users were removed Edit the course settings Set a course image Save changes Open Element Confirm that the room avatar was set
    • 6
    • Team Hedgehog 2023 Sprint 2.2, Team Hedgehog 2023 Review 2, Team Hedgehog 2023 Sprint 3.1

    Description

      The Matrix MVP implements the a variety of API endpoint versions from both matrix and synapse, however Matrix has a comprehensive client/server version support pattern which we need to be aware of for future planning.

      In short, a Matrix API is comprised of a set of Matrix endpoints of various versions. The Specification for Matrix defines which endpoints (and versions) must be defined, and the server must implement a well-known URL which declares which versions of the API is does support.

      As a Matrix Client, Moodle needs to query the server to determine which versions that server supports, and therefore which APIs it implements.

      This issue seeks to:

      • compartmentalise the various Matrix endpoints
      • add that handshake to determine the supported versions
      • simplify the creation of a new client version
      • simplify the instance creation of a client

      Described here: https://spec.matrix.org/unstable/#deprecation-policy

      Some useful resources:
      https://github.com/moodlehq/moodle-enrol_oneroster
      https://github.com/moodlehq/moodle-enrol_oneroster/blob/main/classes/local/endpoints/rostering.php
      https://github.com/moodlehq/moodle-enrol_oneroster/blob/main/classes/local/endpoint.php
      https://github.com/moodlehq/moodle-enrol_oneroster/blob/main/classes/local/v1p1/endpoints/rostering.php

      Attachments

        Issue Links

          Activity

            People

              dobedobedoh Andrew Lyons
              safat.shahin@moodle.com Safat Shahin
              Safat Shahin Safat Shahin
              Jun Pataleta Jun Pataleta
              Ron Carl Alfon Yu Ron Carl Alfon Yu
              Votes:
              0 Vote for this issue
              Watchers:
              6 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 week, 1 hour, 3 minutes
                  1w 1h 3m

                  Clockify

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