fix: scim added users are now auto-added/invited

This commit is contained in:
Ruben Fiszel
2024-02-06 12:24:34 +01:00
parent 06514c8fe1
commit 10896d327a
+5 -1
View File
@@ -190,11 +190,15 @@ pub async fn create_user(
Extension(db): Extension<DB>,
Json(body): Json<CreateUser>,
) -> Result<JsonScim<serde_json::Value>> {
use crate::workspaces::invite_user_to_all_auto_invite_worspaces;
tracing::info!("SCIM creating user: {:?}", body);
let email = body.userName.clone();
sqlx::query!(
"INSERT INTO password (email, login_type, verified) VALUES ($1, 'saml', true) ON CONFLICT DO NOTHING",
body.userName,
&email,
).execute(&db).await?;
invite_user_to_all_auto_invite_worspaces(&db, &email).await?;
Ok(JsonScim(json!({
"schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
"id": body.userName,