Remove delete suer from store interface (#53726)

This commit is contained in:
idafurjes
2022-08-15 13:56:16 +02:00
committed by GitHub
parent 1c0ab501aa
commit dfc75b1114
4 changed files with 4 additions and 9 deletions
@@ -24,6 +24,7 @@ type ServiceAccountsStoreImpl struct {
apiKeyService apikey.Service
kvStore kvstore.KVStore
log log.Logger
userService user.Service
}
func ProvideServiceAccountsStore(store *sqlstore.SQLStore, apiKeyService apikey.Service, kvStore kvstore.KVStore) *ServiceAccountsStoreImpl {
@@ -456,7 +457,7 @@ func (s *ServiceAccountsStoreImpl) CreateServiceAccountFromApikey(ctx context.Co
}
if err := s.assignApiKeyToServiceAccount(sess, key.Id, newSA.ID); err != nil {
if err := s.sqlStore.DeleteUser(ctx, &models.DeleteUserCommand{UserId: newSA.ID}); err != nil {
if err := s.userService.Delete(ctx, &user.DeleteUserCommand{UserID: newSA.ID}); err != nil {
s.log.Error("Error deleting service account", "error", err)
}
return fmt.Errorf("failed to migrate API key to service account token: %w", err)
@@ -170,11 +170,6 @@ func (m *SQLStoreMock) BatchDisableUsers(ctx context.Context, cmd *models.BatchD
return m.ExpectedError
}
func (m *SQLStoreMock) DeleteUser(ctx context.Context, cmd *models.DeleteUserCommand) error {
m.LatestUserId = cmd.UserId
return m.ExpectedError
}
func (m *SQLStoreMock) UpdateUserPermissions(userID int64, isAdmin bool) error {
return m.ExpectedError
}
-1
View File
@@ -38,7 +38,6 @@ type Store interface {
SearchUsers(ctx context.Context, query *models.SearchUsersQuery) error
DisableUser(ctx context.Context, cmd *models.DisableUserCommand) error
BatchDisableUsers(ctx context.Context, cmd *models.BatchDisableUsersCommand) error
DeleteUser(ctx context.Context, cmd *models.DeleteUserCommand) error
UpdateUserPermissions(userID int64, isAdmin bool) error
SetUserHelpFlag(ctx context.Context, cmd *models.SetUserHelpFlagCommand) error
CreateTeam(name, email string, orgID int64) (models.Team, error)