mirror of
https://github.com/dani-garcia/vaultwarden.wiki.git
synced 2026-07-20 20:03:32 +00:00
Org membership delete remove Invitation (#7284)
Co-authored-by: Timshel <timshel@users.noreply.github.com>
This commit is contained in:
@@ -1090,9 +1090,13 @@ async fn send_invite(
|
|||||||
err!(format!("User already in organization: {email}"))
|
err!(format!("User already in organization: {email}"))
|
||||||
}
|
}
|
||||||
|
|
||||||
// automatically accept existing users if mail is disabled
|
if !CONFIG.mail_enabled() {
|
||||||
if !CONFIG.mail_enabled() && !user.password_hash.is_empty() {
|
if user.password_hash.is_empty() {
|
||||||
member_status = MembershipStatus::Accepted as i32;
|
Invitation::new(email).save(&conn).await?;
|
||||||
|
} else {
|
||||||
|
// automatically accept existing users if mail is disabled
|
||||||
|
member_status = MembershipStatus::Accepted as i32;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
user
|
user
|
||||||
}
|
}
|
||||||
@@ -1714,6 +1718,15 @@ async fn delete_member_impl(
|
|||||||
|
|
||||||
if let Some(user) = User::find_by_uuid(&member_to_delete.user_uuid, conn).await {
|
if let Some(user) = User::find_by_uuid(&member_to_delete.user_uuid, conn).await {
|
||||||
nt.send_user_update(UpdateType::SyncOrgKeys, &user, headers.device.push_uuid.as_ref(), conn).await;
|
nt.send_user_update(UpdateType::SyncOrgKeys, &user, headers.device.push_uuid.as_ref(), conn).await;
|
||||||
|
|
||||||
|
if !CONFIG.mail_enabled()
|
||||||
|
&& !Membership::find_invited_by_user(&user.uuid, conn)
|
||||||
|
.await
|
||||||
|
.into_iter()
|
||||||
|
.any(|m| m.uuid != member_to_delete.uuid)
|
||||||
|
{
|
||||||
|
Invitation::take(&user.email, conn).await;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
member_to_delete.delete(conn).await
|
member_to_delete.delete(conn).await
|
||||||
|
|||||||
Reference in New Issue
Block a user