Skip to main content

tuwunel_admin/query/oauth/
adopt.rs

1use tuwunel_core::Result;
2
3use crate::admin_command;
4
5#[admin_command]
6pub(super) async fn oauth_adopt(&self, provider: String) -> Result {
7	let provider = self
8		.services
9		.oauth
10		.providers
11		.get(&provider)
12		.await?;
13
14	let counts = self
15		.services
16		.oauth
17		.sessions
18		.adopt_foreign_subjects(&provider)
19		.await?;
20
21	if !counts.foreign_column {
22		return writeln!(self, "No foreign identity column was found.").await;
23	}
24
25	writeln!(
26		self,
27		"adopted={} already={} collision={} absent={} invalid={}",
28		counts.adopted, counts.already_bound, counts.collision, counts.absent, counts.invalid,
29	)
30	.await
31}