[v11.2.x] Fix: Deduplicate OrgID in SA logins (#94393)

* Fix: Deduplicate OrgID in SA logins (#94378)

* Fix: Deduplicate OrgID in SA logins

(cherry picked from commit b90e09e966)

* Fix: Actually call the DedupOrgInLogin migration (#94520)

* Fix: Account for conflicting logins in dedupOrgInlogin migration (#94669)

---------

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
This commit is contained in:
grafana-delivery-bot[bot]
2024-10-23 15:34:56 +02:00
committed by GitHub
co-authored by Gabriel MABILLE
parent 3576d41ef9
commit ea458d3a15
3 changed files with 220 additions and 0 deletions
@@ -158,6 +158,9 @@ func addUserMigrations(mg *Migrator) {
// Service accounts login were not unique per org. this migration is part of making it unique per org
// to be able to create service accounts that are unique per org
mg.AddMigration(usermig.AllowSameLoginCrossOrgs, &usermig.ServiceAccountsSameLoginCrossOrgs{})
// Before it was fixed, the previous migration introduced the org_id again in logins that already had it.
// This migration removes the duplicate org_id from the login.
mg.AddMigration(usermig.DedupOrgInLogin, &usermig.ServiceAccountsDeduplicateOrgInLogin{})
// Users login and email should be in lower case
mg.AddMigration(usermig.LowerCaseUserLoginAndEmail, &usermig.UsersLowerCaseLoginAndEmail{})