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

Matrix room user manager makes lots of invalid assumptions

XMLWordPrintable

    • MOODLE_403_STABLE
    • MOODLE_403_STABLE
    • MDL-78723-master
    • Hide

      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.

      Test

      1. Run cron in the CLI:

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

      2. In your browser, navigate to https://element:8081/
      3. Log in with:
        1. username: moodlebot
        2. password: password
      4. In a new tab, login to your Moodle site as admin
      5. Navigate to a course which has multiple users
      6. Edit its settings
      7. Open the "Communication" section
      8. Enable Matrix, giving it a room name and topic
      9. Wait a few seconds (should be almost instant)
      10. Open Element
        1. Confirm that the room was created
        2. Confirm that users were invited to, and joined the chat
      11. In Moodle, navigate to the participants list
      12. View the user profile for one of the users (any user)
      13. Edit the profile
      14. Find the matrix userid profile field
        1. Confirm that it is in the format :[username]@[server]
      15. Remove some users from the moodle course
      16. Open Element
        1. Confirm that those users were removed
      Show
      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. Test Run cron in the CLI: while true ; do php admin/cli/cron.php; done In your browser, navigate to https://element:8081/ Log in with: username: moodlebot password: password 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 In Moodle, navigate to the participants list View the user profile for one of the users (any user) Edit the profile Find the matrix userid profile field Confirm that it is in the format : [username] @ [server] Remove some users from the moodle course Open Element Confirm that those users were removed
    • 6
    • Team Hedgehog 2023 Review 2

      • it assumes that your account lives on the organisations home server
      • it assumes a particular format for usernames (which actually remove parts of the URL)
      • it will not let you use a home server with a name containing more than one ., for example matrix.moodle.org will become matrix
      • set_qualified_matrix_user_id is actually a formatter which does not store anything
      • set_matrix_home_server is actualy a formatter which does not store anything

      In addition:

      • it will create the field when fetching, but not when setting a value
      • the tests are unnecessarily using various mock. They should not be. These should be incredibly simple tests that (sadly) use the DB.

            dobedobedoh Andrew Lyons
            dobedobedoh Andrew Lyons
            Safat Shahin Safat Shahin
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

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

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