Auth: Add cli command users-manager for conflict resolution (#52344)

* add users-manager command

* add users-manager command

* rename files

* refactor: imports and renaming

* Command: add conflict merge user command

- MergeUser will
	- replace all user_ids from conflicting users to the chosen userId
	- delete users whose user_ids are not the chosen user
- SameIdentification will
	- update chosen user with chosen email,login details
	- delete users whose user_ids are not the chosen user

* refactor: clean up

* refactor: create structure for read, validate, ingest

* feat: ls and generate-file for conflicting users

* remove usagestats

* added back pkg/services/login/authinfoservice/database/stats.go

* Revert "added back pkg/services/login/authinfoservice/database/stats.go"

This reverts commit 2ba6e3c4d602122bda86911c56934407904eb268.

* Revert "remove usagestats"

This reverts commit 1e3fa978100eed48f4bead0f631b8bd03e01588b.

* cherry pick

* Revert "cherry pick"

This reverts commit 461626c306b9501e3e4eed05a5919caa7a3de884.

* fix test

* make lint

* make test run

* clean up and refactored to align with downstream refactoring

* formatting

* refactor: name list instead of ls

* fix: static lint error use trimprefix

* fix: remove unused functions in sqlstore

* fix: remove unused function

* handling of multiple users and resolve discarded users

* fix tests

* fix: bug that did not exclude the blocks

* ioutil is blacklisted

* should not run tests for mysql

* fix tests
This commit is contained in:
Eric Leijonmarck
2022-08-12 14:47:31 +01:00
committed by GitHub
parent cc777e175e
commit cac3833b8e
3 changed files with 746 additions and 0 deletions

View File

@ -192,6 +192,29 @@ var adminCommands = []*cli.Command{
},
},
},
{
Name: "user-manager",
Usage: "Runs different helpful user commands",
Subcommands: []*cli.Command{
// TODO: reset password for user
{
Name: "conflicts",
Usage: "runs a conflict resolution to find users with multiple entries",
Subcommands: []*cli.Command{
{
Name: "list",
Usage: "returns a list of users with more than one entry in the database",
Action: runListConflictUsers(),
},
{
Name: "generate-file",
Usage: "creates a conflict users file.. Safe to execute multiple times.",
Action: runGenerateConflictUsersFile(),
},
},
},
},
},
}
var Commands = []*cli.Command{