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

Commit 6c02cca

Browse files
authored
Add SSO external_ids to Query User Account admin API (#10261)
Related to #10251
1 parent 76addad commit 6c02cca

File tree

4 files changed

+159
-85
lines changed

4 files changed

+159
-85
lines changed

changelog.d/10261.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add SSO `external_ids` to the Query User Account admin API.

docs/admin_api/user_admin_api.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,17 @@ It returns a JSON body like the following:
3636
"creation_ts": 1560432506,
3737
"appservice_id": null,
3838
"consent_server_notice_sent": null,
39-
"consent_version": null
39+
"consent_version": null,
40+
"external_ids": [
41+
{
42+
"auth_provider": "<provider1>",
43+
"external_id": "<user_id_provider_1>"
44+
},
45+
{
46+
"auth_provider": "<provider2>",
47+
"external_id": "<user_id_provider_2>"
48+
}
49+
]
4050
}
4151
```
4252

synapse/handlers/admin.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,16 @@ async def get_user(self, user: UserID) -> Optional[JsonDict]:
6262
if ret:
6363
profile = await self.store.get_profileinfo(user.localpart)
6464
threepids = await self.store.user_get_threepids(user.to_string())
65+
external_ids = [
66+
({"auth_provider": auth_provider, "external_id": external_id})
67+
for auth_provider, external_id in await self.store.get_external_ids_by_user(
68+
user.to_string()
69+
)
70+
]
6571
ret["displayname"] = profile.display_name
6672
ret["avatar_url"] = profile.avatar_url
6773
ret["threepids"] = threepids
74+
ret["external_ids"] = external_ids
6875
return ret
6976

7077
async def export_user_data(self, user_id: str, writer: "ExfiltrationWriter") -> Any:

0 commit comments

Comments
 (0)