IAM: Create and delete user from the legacy store (#107694)

* Add Create for User + DualWriter setup

* Add delete User

* Fix delete + access check

* Add tests for delete user

* Add tests for create user

* Fixes

* Use sqlx session to fix database locked issues

* wip authz checks

* legacyAccessClient

* Update legacyAccessClient, add tests for create user

* Close rows before running other queries

* Use ExecWithReturningId

* Verify deletion in the tests

* Add Validate and Mutate

* Other changes

* Address feedback

* Update tests

---------

Co-authored-by: Gabriel Mabille <gabriel.mabille@grafana.com>
This commit is contained in:
Misi
2025-07-17 11:50:40 +02:00
committed by GitHub
co-authored by Gabriel Mabille
parent 3e29ca786d
commit c6a6b9fdd2
45 changed files with 1683 additions and 102 deletions
@@ -0,0 +1,9 @@
INSERT INTO {{ .Ident .UserTable }}
(uid, version, login, email, name, org_id, is_admin, is_disabled, email_verified,
is_provisioned, is_service_account, salt, rands, created, updated, last_seen_at)
VALUES
({{ .Arg .Command.UID }}, 0, {{ .Arg .Command.Login }}, {{ .Arg .Command.Email }},
{{ .Arg .Command.Name }}, {{ .Arg .Command.OrgID }}, {{ .Arg .Command.IsAdmin }},
{{ .Arg .Command.IsDisabled }}, {{ .Arg .Command.EmailVerified }},
{{ .Arg .Command.IsProvisioned }}, false, {{ .Arg .Command.Salt }}, {{ .Arg .Command.Rands }},
{{ .Arg .Command.Created }}, {{ .Arg .Command.Updated }}, {{ .Arg .Command.LastSeenAt }})