chore: remove CreateUser from sqlstore & replace with userService.CreateUserForTests (#59910)
This commit is contained in:
@@ -198,7 +198,6 @@ func (ss *SQLStore) ensureMainOrgAndAdminUser() error {
|
||||
if _, err := sess.SQL(rawSQL).Get(&stats); err != nil {
|
||||
return fmt.Errorf("could not determine if admin user exists: %w", err)
|
||||
}
|
||||
|
||||
if stats.Count > 0 {
|
||||
return nil
|
||||
}
|
||||
@@ -206,6 +205,7 @@ func (ss *SQLStore) ensureMainOrgAndAdminUser() error {
|
||||
// ensure admin user
|
||||
if !ss.Cfg.DisableInitAdminCreation {
|
||||
ss.log.Debug("Creating default admin user")
|
||||
|
||||
if _, err := ss.createUser(ctx, sess, user.CreateUserCommand{
|
||||
Login: ss.Cfg.AdminUser,
|
||||
Email: ss.Cfg.AdminEmail,
|
||||
@@ -216,9 +216,6 @@ func (ss *SQLStore) ensureMainOrgAndAdminUser() error {
|
||||
}
|
||||
|
||||
ss.log.Info("Created default admin", "user", ss.Cfg.AdminUser)
|
||||
// Why should we return and not create the default org in this case?
|
||||
// Returning here breaks tests using anonymous access
|
||||
// return nil
|
||||
}
|
||||
|
||||
ss.log.Debug("Creating default org", "name", mainOrgName)
|
||||
|
||||
Reference in New Issue
Block a user