22 Commits

Author SHA1 Message Date
Safat
a946b09410 MDL-78689 core_communication: Add sync provider feature 2023-12-19 11:18:27 +11:00
Huong Nguyen
73769bdd4f
Merge branch 'MDL-79573-master-int' of https://github.com/mickhawkins/moodle 2023-10-06 13:04:36 +07:00
Ilya Tregubov
2b4041f93c
Merge branch 'MDL-79586-master' of https://github.com/safatshahin/moodle 2023-10-06 10:25:39 +08:00
Michael Hawkins
329a9e97d2
MDL-79573 communication: Support new records for each provider type
Previously, we replaced information in the same communication record
in the database, now there will be a unique record per provider.
This ensures when switching between different providers, the correct
actions such as room member management can be actioned for the correct
provider.

This also includes the required updates for the instances to no
longer assume a provider must be enabled to be relevant. Specifying a
provider is optional to fetch a specific provider instance, the default
will use the currently enabled provider.
2023-10-06 09:54:32 +08:00
Safat
75cae1dede MDL-79586 communication: Restrict the use of non-configured providers 2023-10-05 16:53:50 +11:00
Andrew Nicols
5ee0a5f760
MDL-79581 core_communication: Linting fixes 2023-10-04 20:37:58 +08:00
Andrew Nicols
99c1543aa8
MDL-79581 communication: Context is a mandatory field
The API was incorrectly assuming that all uses of the API were for a
course, and that the instanceid of the communication instance was a
course id. These assumptions are both entirely wrong.

The API is intended to support a range of uses including use at the
site, user, and activity levels.

Furthermore, if a group were to be used, then the instanceid should be
of that group's id, and therefore the contextid would need to be fetched
or that group's course instead.

The only solution here is to add a new contextid field to the table, and
implement it all parts of the API.
2023-10-04 20:37:57 +08:00
Stevani Andolo
369fee885f
MDL-78750 communication_matrix: Fixed available providers 2023-09-28 09:13:22 +02:00
Stevani Andolo
d644c3d89d MDL-78750 communication_matrix: Dynamic settings 2023-09-26 09:55:54 +08:00
Andrew Nicols
84cfc8beeb
MDL-78129 communication: Fix all phpcs isuses
This is a brand new subsystem, plugin-type, and plugin. They are written
from the ground up by us. They should not contain any coding style
violations.
2023-09-22 11:08:04 +08:00
Safat
3e47253787
MDL-78129 core_communication: Add update membership api 2023-09-21 13:28:20 +08:00
Andrew Nicols
914686bc5e
MDL-77917 communication_matrix: Support server API versions
This commit brings in support for multiple versions of the Matrix
specification.

A Matrix server is compromised of a number of individually versioned API
endpoints, for example:

    /_matrix/client/v3/createRoom
    /_matrix/client/v3/rooms/:roomid/joined_members
    /_matrix/media/v1/create

The combination of a large number of these individually versioned
endpoints forms a Matrix Specification version.

For example:

* the /_matrix/media/v1/create endpoint was created for version 1.7 of the
  specification, and does not exist in earlier versions.
* in the future a new behaviour or parameter may be created for the
  `createRoom` endpoint and a new endpoint created at:

    /_matrix/client/v4/createRoom

A single server can support multiple versions of the Matrix
specification. The server declares the versions of the specification
that it supports using a non-versioned endpoint at
`/_matrix/client/versions`.

As a Matrix client, Moodle should:
* query the server version endpoint
* determine the combination of mutually supported Matrix specification
  versions
* create a client instance of the highest-supported version of the
  specification.

For example, if Moodle (Matrix client) and a remote server have the
following support:

```
Moodle:      1.1  1.2  1.3  1.4  1.5  1.6  1.7
Server:  r0  1.1  1.2  1.3  1.4  1.5  1.6
```

The versions in common are 1.1 through 1.6, and version 1.6 would be
chosen.

To avoid duplication and allow for support of future features more
easily, the Moodle client is written as:
* a set of classes named `v1p1` through `v1p7` (currently) which extend
  the `matrix_client` abstract class; and
* a set if PHP traits which provide the implementation for individual
  versioned endpoints.

Each client version then imports any relevant traits which are present
in that version of the Matrix Specification. For example versions 1.1 to
1.6 do _not_ have the `/_matrix/media/v1/create` endpoint so they do not
import this trait. This trait was introduced in version 1.7, so the
trait is included from that version onwards.

In the future, if an endpoint is created which conflicts with an
existing endpoint, then it would be easy to create a new client version
which uses the existing common traits, and adds the new trait.

Each endpoint is written using a `command` class which extends the
Guzzle implementation of the PSR-7 Request interface. This command
class adds support for easy creation of:
* path parameters within the URI
* query parameters
* body parameters

This is done to avoid complex patterns of Request creation which are
repeated for every client endpoint.
2023-08-24 11:59:25 +08:00
Huong Nguyen
aeeb1653c0
Merge branch 'MDL-78553-master' of https://github.com/davewoloszyn/moodle 2023-08-03 09:44:24 +07:00
David Woloszyn
317251a978 MDL-78553 core_communication: Move settings to their own page 2023-08-03 12:36:04 +10:00
David Woloszyn
5aea409a87 MDL-78553 behat: Add disable communication helper trait 2023-08-03 10:20:23 +10:00
Andrew Nicols
8b97071c94
MDL-78738 core_communication: Set avatar from a stored_file
We should always use a stored_file instance to set the avatar, and never
a data uri. Especially where the datauri is from Moodle itself.

This change requires a number of changes in associated locations.

I am not adding this change to any upgrade notes as this is a
master-only feature.

Note: I have removed some tests and will not consider fixing them
because I will be entirely removing that test file in a subsequent issue
(MDL-77917).
2023-08-01 19:50:14 +08:00
David Woloszyn
162c9fdd66 MDL-77356 communication: Update avatar filename and avatar synced 2023-06-30 10:38:40 +10:00
Andrew Nicols
54f2722a7b
Merge branch 'MDL-78523-master' of https://github.com/safatshahin/moodle 2023-06-24 23:39:37 +08:00
Safat
d785ff6f57 MDL-78523 core_communication: Safe disable of communication plugins 2023-06-22 12:19:44 +10:00
Safat
3f48306385 MDL-76704 core_communication: Default setting for communication provider 2023-06-21 14:46:32 +10:00
Safat
9a060a6d8d MDL-77576 communication_matrix: Create Matrix plugin
This commit will implement a matrix communication plugin
to integrate matrix services with core communication.

Originally implemented as MDL-76701, MDL-76702, MDL-77357,
MDL-76705, MDL-77473 and  MDL-76708.

Co-Authored-By: Stevani Andolo <stevani.andolo@moodle.com>
Co-Authored-By: David Woloszyn <david.woloszyn@moodle.com>
Co-Authored-By: Safat Shahin <safat.shahin@moodle.com>
2023-05-11 13:35:16 +10:00
Safat
ca1e5d0beb MDL-77576 core_communication: Add core communication api
This commit will implement the base api for core
communication. This will include the room creation,
room membership, room access url and all associated
api and related interfaces.

Originally implemented as MDL-76702, MDL-76703 and MDL-76705.

Co-Authored-By: David Woloszyn <david.woloszyn@moodle.com>
Co-Authored-By: Safat Shahin <safat.shahin@moodle.com>
2023-05-11 13:35:16 +10:00