RBAC: Make RBAC action names more consistent (#49730)
* update action names * correctly retrieve teams for signed in user * remove test * undo swagger changes * undo swagger changes pt2 * add migration from old action names to the new ones * rename from list to read * linting * also update alertign actions * fix migration
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/services/serviceaccounts"
|
||||
"github.com/grafana/grafana/pkg/services/serviceaccounts/tests"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore"
|
||||
@@ -107,20 +106,3 @@ func TestStore_RetrieveServiceAccount(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
func TestStore_RetrieveServiceAccountWithTeams(t *testing.T) {
|
||||
userToCreate := tests.TestUser{Login: "servicetestwithTeam@admin", IsServiceAccount: true}
|
||||
db, store := setupTestDatabase(t)
|
||||
user := tests.SetupUserServiceAccount(t, db, userToCreate)
|
||||
|
||||
team, err := store.sqlStore.CreateTeam("serviceTeam", "serviceTeam", user.OrgId)
|
||||
require.NoError(t, err)
|
||||
|
||||
err = store.sqlStore.AddTeamMember(user.Id, user.OrgId, team.Id, false, models.PERMISSION_VIEW)
|
||||
require.NoError(t, err)
|
||||
|
||||
dto, err := store.RetrieveServiceAccount(context.Background(), user.OrgId, user.Id)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, userToCreate.Login, dto.Login)
|
||||
require.Len(t, dto.Teams, 1)
|
||||
require.Equal(t, "serviceTeam", dto.Teams[0])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user