[v9.4.x] fix: create temp user no longer sets ID to 0 for all users (#64160)

fix: create temp user no longer sets ID to 0 for all users (#64149)

* fix: create temp user no longer sets ID to 0 for all users

The xorm tag added to the tempuser ID field caused xorm to create all temp users with ID 0. Removing that tag allows xorm to set the ID based on the database result instead. I also added a test which was failing before this.

Fixes #63995

(cherry picked from commit dbb72f2c6e)

Co-authored-by: Kristin Laemmert <mildwonkey@users.noreply.github.com>
This commit is contained in:
Grot (@grafanabot)
2023-03-03 11:24:21 -05:00
committed by GitHub
co-authored by Kristin Laemmert
parent 5ccddbe071
commit 5014df0521
2 changed files with 8 additions and 1 deletions
@@ -32,6 +32,13 @@ func TestIntegrationTempUserCommandsAndQueries(t *testing.T) {
require.Nil(t, err)
}
t.Run("Can create multiple temp users", func(t *testing.T) {
setup(t)
created, err := store.CreateTempUser(context.Background(), &cmd)
require.Nil(t, err)
require.Equal(t, int64(2), created.ID)
})
t.Run("Should be able to get temp users by org id", func(t *testing.T) {
setup(t)
query := tempuser.GetTempUsersQuery{OrgID: 2256, Status: tempuser.TmpUserInvitePending}