diff options
author | Brendan Abolivier <babolivier@matrix.org> | 2022-03-28 18:57:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-28 18:57:19 +0200 |
commit | 8cd760fca8aaa391fc265f555f6572ed00709a68 (patch) | |
tree | 0132c39700c00b8615c9e6b5d60329155357b9b9 | |
parent | Improve type annotations for `execute_values`. (#12311) (diff) | |
download | synapse-8cd760fca8aaa391fc265f555f6572ed00709a68.tar.xz |
Allow modules to store already existing 3PID associations (#12195)
-rw-r--r-- | changelog.d/12195.feature | 1 | ||||
-rw-r--r-- | synapse/module_api/__init__.py | 27 |
2 files changed, 27 insertions, 1 deletions
diff --git a/changelog.d/12195.feature b/changelog.d/12195.feature new file mode 100644 index 0000000000..e8bcb950a1 --- /dev/null +++ b/changelog.d/12195.feature @@ -0,0 +1 @@ +Allow modules to store already existing 3PID associations. diff --git a/synapse/module_api/__init__.py b/synapse/module_api/__init__.py index a628faaf65..ba9755f08b 100644 --- a/synapse/module_api/__init__.py +++ b/synapse/module_api/__init__.py @@ -671,7 +671,8 @@ class ModuleApi: def record_user_external_id( self, auth_provider_id: str, remote_user_id: str, registered_user_id: str ) -> defer.Deferred: - """Record a mapping from an external user id to a mxid + """Record a mapping between an external user id from a single sign-on provider + and a mxid. Added in Synapse v1.9.0. @@ -1286,6 +1287,30 @@ class ModuleApi: """ await self._registration_handler.check_username(username) + async def store_remote_3pid_association( + self, user_id: str, medium: str, address: str, id_server: str + ) -> None: + """Stores an existing association between a user ID and a third-party identifier. + + The association must already exist on the remote identity server. + + Added in Synapse v1.56.0. + + Args: + user_id: The user ID that's been associated with the 3PID. + medium: The medium of the 3PID (current supported values are "msisdn" and + "email"). + address: The address of the 3PID. + id_server: The identity server the 3PID association has been registered on. + This should only be the domain (or IP address, optionally with the port + number) for the identity server. This will be used to reach out to the + identity server using HTTPS (unless specified otherwise by Synapse's + configuration) when attempting to unbind the third-party identifier. + + + """ + await self._store.add_user_bound_threepid(user_id, medium, address, id_server) + class PublicRoomListManager: """Contains methods for adding to, removing from and querying whether a room |