Kaynağa Gözat

teams: bugfix, user pointer.

Leonard Gram 6 yıl önce
ebeveyn
işleme
319879cfa8

+ 2 - 2
pkg/services/teams/team.go

@@ -5,7 +5,7 @@ import (
 	m "github.com/grafana/grafana/pkg/models"
 	m "github.com/grafana/grafana/pkg/models"
 )
 )
 
 
-func canUpdateTeam(orgId int64, teamId int64, user m.SignedInUser) error {
+func canUpdateTeam(orgId int64, teamId int64, user *m.SignedInUser) error {
 	if user.OrgRole == m.ROLE_ADMIN {
 	if user.OrgRole == m.ROLE_ADMIN {
 		return nil
 		return nil
 	}
 	}
@@ -36,7 +36,7 @@ func canUpdateTeam(orgId int64, teamId int64, user m.SignedInUser) error {
 	return m.ErrNotAllowedToUpdateTeam
 	return m.ErrNotAllowedToUpdateTeam
 }
 }
 
 
-func UpdateTeam(user m.SignedInUser, cmd *m.UpdateTeamCommand) error {
+func UpdateTeam(user *m.SignedInUser, cmd *m.UpdateTeamCommand) error {
 	if err := canUpdateTeam(cmd.OrgId, cmd.Id, user); err != nil {
 	if err := canUpdateTeam(cmd.OrgId, cmd.Id, user); err != nil {
 		return err
 		return err
 	}
 	}

+ 4 - 4
pkg/services/teams/teams_test.go

@@ -32,7 +32,7 @@ func TestUpdateTeam(t *testing.T) {
 					return nil
 					return nil
 				})
 				})
 
 
-				err := UpdateTeam(editor, &cmd)
+				err := UpdateTeam(&editor, &cmd)
 
 
 				So(err, ShouldEqual, m.ErrNotAllowedToUpdateTeam)
 				So(err, ShouldEqual, m.ErrNotAllowedToUpdateTeam)
 			})
 			})
@@ -73,7 +73,7 @@ func TestUpdateTeam(t *testing.T) {
 					return nil
 					return nil
 				})
 				})
 
 
-				err := UpdateTeam(editor, &cmd)
+				err := UpdateTeam(&editor, &cmd)
 
 
 				So(teamUpdated, ShouldBeTrue)
 				So(teamUpdated, ShouldBeTrue)
 				So(err, ShouldBeNil)
 				So(err, ShouldBeNil)
@@ -111,7 +111,7 @@ func TestUpdateTeam(t *testing.T) {
 					return nil
 					return nil
 				})
 				})
 
 
-				err := UpdateTeam(editor, &cmd)
+				err := UpdateTeam(&editor, &cmd)
 
 
 				So(err, ShouldEqual, m.ErrNotAllowedToUpdateTeamInDifferentOrg)
 				So(err, ShouldEqual, m.ErrNotAllowedToUpdateTeamInDifferentOrg)
 			})
 			})
@@ -142,7 +142,7 @@ func TestUpdateTeam(t *testing.T) {
 					return nil
 					return nil
 				})
 				})
 
 
-				err := UpdateTeam(editor, &cmd)
+				err := UpdateTeam(&editor, &cmd)
 
 
 				So(teamUpdated, ShouldBeTrue)
 				So(teamUpdated, ShouldBeTrue)
 				So(err, ShouldBeNil)
 				So(err, ShouldBeNil)