mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-05-24 09:03:15 -05:00
[PR #6262] [MERGED] Fix sso_user dropped on User::save
#21952
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/dani-garcia/vaultwarden/pull/6262
Author: @Timshel
Created: 9/1/2025
Status: ✅ Merged
Merged: 10/13/2025
Merged by: @BlackDex
Base:
main← Head:fix/association📝 Commits (4)
e4e5a40Admin delete SSO association prompt5cb8feeUser.save don't use replace_into113a5caUser.save use upsert with sqliteba6176dUser.save use upsert with mysql📊 Changes
2 files changed (+11 additions, -18 deletions)
View changed files
📝
src/db/models/user.rs(+9 -16)📝
src/static/scripts/admin_users.js(+2 -2)📄 Description
Should fix https://github.com/dani-garcia/vaultwarden/issues/6179#issuecomment-3242088962 and https://github.com/dani-garcia/vaultwarden/issues/6253
The issue is that if there is no
ForeignKeyViolationaUser::savefirst delete the record withsqliteandmysql.Since the
sso_usertable was added withON UPDATE CASCADE ON DELETE CASCADE, the violation was not triggered and the entry was deleted.I thought changing the
savelogic was better than changing the cascade logic since :updateis the happy path (as opposed to the violation being triggered in most cases).SSO_SIGNUPS_MATCH_EMAILthe association was just restored).Made the change only for
Userbut it probably would apply to most table.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.