(
&self,
external_id: &str,
email: &str,
email_verified: bool,
user_info: &S,
)
| 39 | } |
| 40 | |
| 41 | async fn create_and_provision_user<S>( |
| 42 | &self, |
| 43 | external_id: &str, |
| 44 | email: &str, |
| 45 | email_verified: bool, |
| 46 | user_info: &S, |
| 47 | ) -> Result<user::User> |
| 48 | where |
| 49 | S: Serialize, |
| 50 | { |
| 51 | let u = user::User { |
| 52 | is_active: true, |
| 53 | email: email.to_string(), |
| 54 | email_verified, |
| 55 | external_id: Some(external_id.to_string()), |
| 56 | ..Default::default() |
| 57 | }; |
| 58 | let mut u = user::create(u).await?; |
| 59 | if let Err(e) = self.provision_user(&u.id, user_info).await { |
| 60 | error!(error = %e, "Provisioning user failed"); |
| 61 | user::delete(&u.id).await?; |
| 62 | return Err(e); |
| 63 | } |
| 64 | |
| 65 | // fetch user again because the provisioning callback url may have updated the user. |
| 66 | u = user::get(&u.id).await?; |
| 67 | |
| 68 | Ok(u) |
| 69 | } |
| 70 | |
| 71 | async fn provision_user<S>(&self, user_id: &Uuid, user_info: &S) -> Result<()> |
| 72 | where |
no test coverage detected