-
New Feature
-
Resolution: Done
-
Minor
-
None
-
4.2
-
MOODLE_402_STABLE
-
MDL-76701-master -
-
20
-
Team Hedgehog Sprint 1 review, Team Hedgehog Sprint 2.1
-
Large
Create the initial plugin to interface with the Matrix Synapse server. This will be the plugin that does the actual API communication with the Matrix server. It should leverage the Guzzle PHP lib (MDL-76135) for comms and test mocking.
The scope of this task is to create the “basics” of the plugin, which allows admins to set up their Matrix connection and configure the sitewide settings as outlined in the user stories below. Using admin settings pages.
This plugin will likely need to implement webservices to support Matrix integration for the Moodle Mobile App as well as some Ajax related calls. For example linking/redirection to a Matrix homeserver. Some specific webservices will be added by other related trackers (such as creating rooms).
Proposed plugin name: comm_matrix
User stories:
- 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 expect that Matrix chat rooms for new courses are enabled by default when I upgrade to Moodle 4.2 (providing I have configured my Moodle to connect to a Matrix homeserver). So that going forward new courses have a better communication experience.
- As an admin I want to be able to set a default for new courses to either have Matrix rooms created or not. To assist my teachers.
Admin Fields:
The initial set of site wide plugins settings for admins, should be:
- Synapse Homeserver URL
- This is the URL of the Synapse Homeserver to connect to, for user and room creation.
- This is a required field
- E.g. https://synapse:8008/ or https://matrix.mycompany.org/
- Access Token
- An admin access token to authenticate against the Synapse Homeserver
- This is a required field
- This should be a password field
- Refresh Token
- The admin refresh token to associated with the access token
- This field is required
- This should be a password field.
- Element Web URL
- The URL to your Element Web instance.
- This field is required.
- Create rooms for new courses checkbox
- When selected, new courses will have Matrix rooms enabled by default.
- Defaults to on.
The original idea was to have an admin username and password to access the Synapse server. However, the rationale in the Synapse docs makes a good case for using the access and refresh tokens. See: https://matrix-org.github.io/synapse/latest/usage/configuration/user_authentication/refresh_tokens.html
For the first iteration of development we’ll make the element web client url a requirement. This makes the workflow from Moodle to element for students and teachers easier. It will also give more time to work on the UX workflows for when an element web client isn’t available and/or the dedicated element app is available.
Existing plugin
It looks like the Matrix team have made a Moodle plugin themselves, here: https://github.com/matrix-org/moodle-mod_matrix/
It would be good to review their approach, particularly around which Matrix API calls they used.