Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 8cd760f

Browse files
authored
Allow modules to store already existing 3PID associations (#12195)
1 parent 89f11f8 commit 8cd760f

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

changelog.d/12195.feature

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Allow modules to store already existing 3PID associations.

synapse/module_api/__init__.py

+26-1
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,8 @@ def register_device(
671671
def record_user_external_id(
672672
self, auth_provider_id: str, remote_user_id: str, registered_user_id: str
673673
) -> defer.Deferred:
674-
"""Record a mapping from an external user id to a mxid
674+
"""Record a mapping between an external user id from a single sign-on provider
675+
and a mxid.
675676
676677
Added in Synapse v1.9.0.
677678
@@ -1286,6 +1287,30 @@ async def check_username(self, username: str) -> None:
12861287
"""
12871288
await self._registration_handler.check_username(username)
12881289

1290+
async def store_remote_3pid_association(
1291+
self, user_id: str, medium: str, address: str, id_server: str
1292+
) -> None:
1293+
"""Stores an existing association between a user ID and a third-party identifier.
1294+
1295+
The association must already exist on the remote identity server.
1296+
1297+
Added in Synapse v1.56.0.
1298+
1299+
Args:
1300+
user_id: The user ID that's been associated with the 3PID.
1301+
medium: The medium of the 3PID (current supported values are "msisdn" and
1302+
"email").
1303+
address: The address of the 3PID.
1304+
id_server: The identity server the 3PID association has been registered on.
1305+
This should only be the domain (or IP address, optionally with the port
1306+
number) for the identity server. This will be used to reach out to the
1307+
identity server using HTTPS (unless specified otherwise by Synapse's
1308+
configuration) when attempting to unbind the third-party identifier.
1309+
1310+
1311+
"""
1312+
await self._store.add_user_bound_threepid(user_id, medium, address, id_server)
1313+
12891314

12901315
class PublicRoomListManager:
12911316
"""Contains methods for adding to, removing from and querying whether a room

0 commit comments

Comments
 (0)