Matrix: Difference between revisions

From MoodleDocs
m (Added link to Spanish page)
(Added password management section)
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Communication}}
{{Communication}}
===Matrix===
[https://en.wikipedia.org/wiki/Matrix_(protocol) Matrix] is an open and federated messaging platform that compares well against MS Teams, Slack, Telegram and WhatsApp.  See [https://matrix.org matrix.org] for all the details. It not only supports typical text messages, images and files, but also  has full audio and video conference calling.  Unlike other platforms, there are many clients you can use, but the most popular one is [https://element.io/download Element].
[https://en.wikipedia.org/wiki/Matrix_(protocol) Matrix] is a messaging platform that Moodle uses for its global chat system. If the admin has configured your site to use a Matrix server, the option to select Matrix as a provider will be available. Choosing Matrix will prompt you to enter in a room name and room topic. Some values are provider specific and will vary between providers:


=====Room name=====
Moodle HQ itself uses Matrix heavily for internal communication, as well as for the [https://matrix.to/#/#community:moodle.com Moodle Community chat rooms].
Providing a room name is option. If no room name is entered the course name will be used.


===== Room topic=====
Anyone can just create a free account on matrix.org (you will get an address like '''@yourname:matrix.org'''), but because it is open source, you can also run your own private Matrix server for your organisation, then everyone will have accounts like '''@yourname:yourdomain.com'''.  Any user on any domain can send messages to any other Matrix domain (similar to how email works).
The room topic is also optional and effectively works as a description for the room. As explained above, Matrix has its own set of individual settings and room topic is one of them.
 
=== Configuring Matrix in a course (for teachers) ===
Once the Moodle admin has configured your Moodle site to connect to a Matrix server, teachers will have the option to select Matrix as a provider in courses.
 
Choosing Matrix from the communication configuration in the course will prompt you to enter in a room name and room topic. Some values are provider specific and will vary between providers. The screenshot below demonstrates a typical Matrix room configuration for a course.


[[File:MatrixProvider.png|alt=Course communication settings for Matrix|700x700px]]
[[File:MatrixProvider.png|alt=Course communication settings for Matrix|700x700px]]


===Room moderators===
==== Room name ====
Providing a room name is optional. If no room name is entered the course name will be used.
 
==== Room topic ====
The room topic is also optional and effectively works as a description for the room. As explained above, Matrix has its own set of individual settings and room topic is one of them.
 
==== Room moderators ====
Room moderators will have elevated privileges in Matrix rooms. There is a hierarchy that is determined by the roles assigned in Moodle. In order of privilege, they are:
Room moderators will have elevated privileges in Matrix rooms. There is a hierarchy that is determined by the roles assigned in Moodle. In order of privilege, they are:


Line 20: Line 28:
Teachers, non-editing teachers and managers will automatically have the moderator capability in the Matrix room. This role (communication/matrix:moderator) can be changed in the ''Define role'' settings in Site administration.
Teachers, non-editing teachers and managers will automatically have the moderator capability in the Matrix room. This role (communication/matrix:moderator) can be changed in the ''Define role'' settings in Site administration.


===Configuring Matrix===
=== Password management ===
There are certain password limitations with the current way Moodle creates users in Matrix. When a new user is created in Matrix, only a username and email is set in their Matrix user record. When users attempt to authenticate with a Matrix client (e.g. Element), they will be forced to reset their password using the 'Forgot password?' link. This provides a way for users to determine their own password and manage it independent of Moodle.
 
===Configuring Matrix (for site administrators)===
The Matrix communication provider allows Moodle LMS courses to have an associated room in a [https://element.io/ Matrix Element] instance. It also provides user management by synchronising participants in a course with the associated Matrix Element room.
The Matrix communication provider allows Moodle LMS courses to have an associated room in a [https://element.io/ Matrix Element] instance. It also provides user management by synchronising participants in a course with the associated Matrix Element room.


Line 40: Line 51:




====Synapse API access token generation====
 
==== Synapse API access token generation (for site administrators) ====
To generate an API access token for Moodle LMS, you need access to a terminal and use an existing username and password for the admin of your Synapse server instance.
To generate an API access token for Moodle LMS, you need access to a terminal and use an existing username and password for the admin of your Synapse server instance.


Line 55: Line 67:
The ''access_token'' field is the API access token to use in the Moodle LMS Matrix communication provider settings.
The ''access_token'' field is the API access token to use in the Moodle LMS Matrix communication provider settings.


==Data flow between Moodle LMS and Matrix==
==== Data flow between Moodle LMS and Matrix ====
 
*The current implementation uses the Moodle Course Communication settings to set the room name and room topic for the Matrix room. If those fields are empty, the course name is used as the room name and the room topic is kept empty.
*The current implementation uses the Moodle Course Communication settings to set the room name and room topic for the Matrix room. If those fields are empty, the course name is used as the room name and the room topic is kept empty.
*Matrix usernames are generated using Moodle usernames and are necessary for adding Matrix users to a room.
*Matrix usernames are generated using Moodle usernames and are necessary for adding Matrix users to a room.
*Authentication to Matrix is handled from Moodle LMS.
*Users are only created in Matrix if they have not been created yet, or no mapping to that user is recorded with Moodle LMS.
*Users are only created in Matrix if they have not been created yet, or no mapping to that user is recorded with Moodle LMS.




The following diagram shows the flow of data between Moodle LMS and Matrix.
The following diagram shows the flow of data between Moodle LMS and Matrix.
 
[[File:Data flow diragram-communication(1).png|alt=Data flow diragram-communication|left|frame|Data flow diragram-communication]]
[[File:Communication_data_flow_diagram.png|alt=Communication data flow diagram]]


==Capabilities==
==Capabilities==

Latest revision as of 01:01, 9 May 2024

Matrix is an open and federated messaging platform that compares well against MS Teams, Slack, Telegram and WhatsApp. See matrix.org for all the details. It not only supports typical text messages, images and files, but also has full audio and video conference calling. Unlike other platforms, there are many clients you can use, but the most popular one is Element.

Moodle HQ itself uses Matrix heavily for internal communication, as well as for the Moodle Community chat rooms.

Anyone can just create a free account on matrix.org (you will get an address like @yourname:matrix.org), but because it is open source, you can also run your own private Matrix server for your organisation, then everyone will have accounts like @yourname:yourdomain.com. Any user on any domain can send messages to any other Matrix domain (similar to how email works).

Configuring Matrix in a course (for teachers)

Once the Moodle admin has configured your Moodle site to connect to a Matrix server, teachers will have the option to select Matrix as a provider in courses.

Choosing Matrix from the communication configuration in the course will prompt you to enter in a room name and room topic. Some values are provider specific and will vary between providers. The screenshot below demonstrates a typical Matrix room configuration for a course.

Course communication settings for Matrix

Room name

Providing a room name is optional. If no room name is entered the course name will be used.

Room topic

The room topic is also optional and effectively works as a description for the room. As explained above, Matrix has its own set of individual settings and room topic is one of them.

Room moderators

Room moderators will have elevated privileges in Matrix rooms. There is a hierarchy that is determined by the roles assigned in Moodle. In order of privilege, they are:

  1. Admin
  2. Managers, teachers, non-editing teachers
  3. Students

Teachers, non-editing teachers and managers will automatically have the moderator capability in the Matrix room. This role (communication/matrix:moderator) can be changed in the Define role settings in Site administration.

Password management

There are certain password limitations with the current way Moodle creates users in Matrix. When a new user is created in Matrix, only a username and email is set in their Matrix user record. When users attempt to authenticate with a Matrix client (e.g. Element), they will be forced to reset their password using the 'Forgot password?' link. This provides a way for users to determine their own password and manage it independent of Moodle.

Configuring Matrix (for site administrators)

The Matrix communication provider allows Moodle LMS courses to have an associated room in a Matrix Element instance. It also provides user management by synchronising participants in a course with the associated Matrix Element room.

Currently, the integration supports the Synapse homeserver for setting up the provider service, and the Matrix Element messaging client for accessing the room. To configure your Moodle LMS instance with Matrix you will need the following:

  • URL of the Synapse homeserver
  • API access token for a Synapse admin user
  • URL of an Element web server to use


Configuring Matrix provider

To configure your Moodle LMS instance to use the Matrix provider:

  1. Enter the URL of your Synapse server in the 'Homeserver URL' field (matrixhomeserverurl)
  2. Enter the Synapse server API Access token in the 'Access token' field (matrixaccesstoken). See 'Synapse API access token generation' below.
  3. Enter the URL of the Element web server in the 'Element web URL' field (matrixelementurl)
  4. Click Save changes.


Synapse API access token generation (for site administrators)

To generate an API access token for Moodle LMS, you need access to a terminal and use an existing username and password for the admin of your Synapse server instance.

  • The username will need to be formatted as follows: @<username_on_homeserver>:<homeserver_domain>
  • Password is the admin user's regular password.


To generate an access token to be used with Moodle LMS, enter the following into a terminal:

curl -XPOST -d '{"type":"m.login.password", "user":"@admin:synapse", "password":"secretpass"}' "https://synapse:8008/_matrix/client/r0/login"

The returned value will look something like this:

{"user_id":"@admin:synapse","access_token":"syt_YWRtaW4_OQNsHwWoObhseRAWmUCs_2T29if","home_server":"synapse","device_id":"JPAIBCQCSB"}

The access_token field is the API access token to use in the Moodle LMS Matrix communication provider settings.

Data flow between Moodle LMS and Matrix

  • The current implementation uses the Moodle Course Communication settings to set the room name and room topic for the Matrix room. If those fields are empty, the course name is used as the room name and the room topic is kept empty.
  • Matrix usernames are generated using Moodle usernames and are necessary for adding Matrix users to a room.
  • Users are only created in Matrix if they have not been created yet, or no mapping to that user is recorded with Moodle LMS.


The following diagram shows the flow of data between Moodle LMS and Matrix.

Data flow diragram-communication
Data flow diragram-communication

Capabilities