tuwunel_admin/query/oauth/
delete.rs1use tuwunel_core::{
2 Err, Result,
3 either::{Left, Right},
4};
5
6use super::SessionOrUserId;
7use crate::admin_command;
8
9#[admin_command]
10pub(super) async fn oauth_delete(&self, id: SessionOrUserId, force: bool) -> Result {
11 if !force {
12 return Err!(
13 "Deleting these records can cause registration conflicts. Use --force to be sure."
14 );
15 }
16
17 match &id {
18 | Left(sess_id) => {
19 self.services.oauth.sessions.delete(sess_id).await;
20 },
21 | Right(user_id) => {
22 self.services
23 .oauth
24 .delete_user_sessions(user_id)
25 .await;
26 },
27 }
28
29 write!(self, "deleted any oauth state for {id}").await
30}