mirror of
https://github.com/grafana/grafana.git
synced 2026-08-11 05:34:53 -05:00
@@ -73,7 +73,7 @@ func TestIntegrationAccountDataAccess(t *testing.T) {
|
||||
Role: org.RoleViewer,
|
||||
}
|
||||
|
||||
err := sqlStore.AddOrgUser(context.Background(), &cmd)
|
||||
err := sqlStore.addOrgUser(context.Background(), &cmd)
|
||||
t.Run("Should have been saved without error", func(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
})
|
||||
@@ -142,7 +142,7 @@ func TestIntegrationAccountDataAccess(t *testing.T) {
|
||||
Role: org.RoleViewer,
|
||||
}
|
||||
|
||||
err = sqlStore.AddOrgUser(context.Background(), &orgUserCmd)
|
||||
err = sqlStore.addOrgUser(context.Background(), &orgUserCmd)
|
||||
require.NoError(t, err)
|
||||
|
||||
dash1 := insertTestDashboard(t, sqlStore, "1 test dash", ac1.OrgID, 0, false, "prod", "webapp")
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
)
|
||||
|
||||
func (ss *SQLStore) AddOrgUser(ctx context.Context, cmd *models.AddOrgUserCommand) error {
|
||||
func (ss *SQLStore) addOrgUser(ctx context.Context, cmd *models.AddOrgUserCommand) error {
|
||||
return ss.WithTransactionalDbSession(ctx, func(sess *DBSession) error {
|
||||
// check if user exists
|
||||
var usr user.User
|
||||
|
||||
@@ -32,7 +32,7 @@ func TestSQLStore_AddOrgUser(t *testing.T) {
|
||||
require.Equal(t, int64(-1), sa.OrgID)
|
||||
|
||||
// assign the sa to the org but without the override. should fail
|
||||
err = store.AddOrgUser(context.Background(), &models.AddOrgUserCommand{
|
||||
err = store.addOrgUser(context.Background(), &models.AddOrgUserCommand{
|
||||
Role: "Viewer",
|
||||
OrgId: orgID,
|
||||
UserId: sa.ID,
|
||||
@@ -40,7 +40,7 @@ func TestSQLStore_AddOrgUser(t *testing.T) {
|
||||
require.Error(t, err)
|
||||
|
||||
// assign the sa to the org with the override. should succeed
|
||||
err = store.AddOrgUser(context.Background(), &models.AddOrgUserCommand{
|
||||
err = store.addOrgUser(context.Background(), &models.AddOrgUserCommand{
|
||||
Role: "Viewer",
|
||||
OrgId: orgID,
|
||||
UserId: sa.ID,
|
||||
|
||||
@@ -86,7 +86,7 @@ func populateDB(t *testing.T, sqlStore *SQLStore) {
|
||||
UserId: users[1].ID,
|
||||
Role: org.RoleEditor,
|
||||
}
|
||||
err := sqlStore.AddOrgUser(context.Background(), cmd)
|
||||
err := sqlStore.addOrgUser(context.Background(), cmd)
|
||||
require.NoError(t, err)
|
||||
|
||||
// add 3rd user as viewer
|
||||
@@ -95,7 +95,7 @@ func populateDB(t *testing.T, sqlStore *SQLStore) {
|
||||
UserId: users[2].ID,
|
||||
Role: org.RoleViewer,
|
||||
}
|
||||
err = sqlStore.AddOrgUser(context.Background(), cmd)
|
||||
err = sqlStore.addOrgUser(context.Background(), cmd)
|
||||
require.NoError(t, err)
|
||||
|
||||
// add 1st user as admin
|
||||
@@ -104,7 +104,7 @@ func populateDB(t *testing.T, sqlStore *SQLStore) {
|
||||
UserId: users[0].ID,
|
||||
Role: org.RoleAdmin,
|
||||
}
|
||||
err = sqlStore.AddOrgUser(context.Background(), cmd)
|
||||
err = sqlStore.addOrgUser(context.Background(), cmd)
|
||||
require.NoError(t, err)
|
||||
|
||||
// force renewal of user stats
|
||||
|
||||
Reference in New Issue
Block a user