ServiceAccounts: Remove permissions to service account when it is deleted (#93877)

* Service account: clean up permissions related to service accounts when deleted

* Add migration for deleting orphaned service account permissions

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
This commit is contained in:
Karl Persson
2024-10-04 09:01:09 +02:00
committed by GitHub
co-authored by Ieva
parent 943525391e
commit c7ca2bfcf5
5 changed files with 114 additions and 7 deletions
@@ -14,8 +14,9 @@ import (
func Test_UsageStats(t *testing.T) {
acSvc := actest.FakeService{}
pSvc := actest.FakePermissionsService{}
storeMock := newServiceAccountStoreFake()
svc := ServiceAccountsService{acSvc, storeMock, log.New("test"), log.New("background-test"), &SecretsCheckerFake{}, true, 5}
svc := ServiceAccountsService{acSvc, &pSvc, storeMock, log.NewNopLogger(), log.NewNopLogger(), &SecretsCheckerFake{}, true, 5}
err := svc.DeleteServiceAccount(context.Background(), 1, 1)
require.NoError(t, err)