mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
refactor: format files by gofmt
This commit is contained in:
@@ -43,7 +43,7 @@ func UpdateDashboardAcl(c *middleware.Context, apiCmd dtos.UpdateDashboardAclCom
|
|||||||
OrgId: c.OrgId,
|
OrgId: c.OrgId,
|
||||||
DashboardId: dashId,
|
DashboardId: dashId,
|
||||||
UserId: item.UserId,
|
UserId: item.UserId,
|
||||||
TeamId: item.TeamId,
|
TeamId: item.TeamId,
|
||||||
Role: item.Role,
|
Role: item.Role,
|
||||||
Permission: item.Permission,
|
Permission: item.Permission,
|
||||||
Created: time.Now(),
|
Created: time.Now(),
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ func transformDashboardAclsToDTOs(acls []*m.DashboardAclInfoDTO) []*m.DashboardA
|
|||||||
DashboardId: acl.DashboardId,
|
DashboardId: acl.DashboardId,
|
||||||
Permission: acl.Permission,
|
Permission: acl.Permission,
|
||||||
UserId: acl.UserId,
|
UserId: acl.UserId,
|
||||||
TeamId: acl.TeamId,
|
TeamId: acl.TeamId,
|
||||||
}
|
}
|
||||||
dtos = append(dtos, dto)
|
dtos = append(dtos, dto)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ type UpdateDashboardAclCommand struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type DashboardAclUpdateItem struct {
|
type DashboardAclUpdateItem struct {
|
||||||
UserId int64 `json:"userId"`
|
UserId int64 `json:"userId"`
|
||||||
TeamId int64 `json:"teamId"`
|
TeamId int64 `json:"teamId"`
|
||||||
Role *m.RoleType `json:"role,omitempty"`
|
Role *m.RoleType `json:"role,omitempty"`
|
||||||
Permission m.PermissionType `json:"permission"`
|
Permission m.PermissionType `json:"permission"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,10 +34,10 @@ type DashboardAcl struct {
|
|||||||
OrgId int64
|
OrgId int64
|
||||||
DashboardId int64
|
DashboardId int64
|
||||||
|
|
||||||
UserId int64
|
UserId int64
|
||||||
TeamId int64
|
TeamId int64
|
||||||
Role *RoleType // pointer to be nullable
|
Role *RoleType // pointer to be nullable
|
||||||
Permission PermissionType
|
Permission PermissionType
|
||||||
|
|
||||||
Created time.Time
|
Created time.Time
|
||||||
Updated time.Time
|
Updated time.Time
|
||||||
@@ -54,8 +54,8 @@ type DashboardAclInfoDTO struct {
|
|||||||
UserId int64 `json:"userId"`
|
UserId int64 `json:"userId"`
|
||||||
UserLogin string `json:"userLogin"`
|
UserLogin string `json:"userLogin"`
|
||||||
UserEmail string `json:"userEmail"`
|
UserEmail string `json:"userEmail"`
|
||||||
TeamId int64 `json:"teamId"`
|
TeamId int64 `json:"teamId"`
|
||||||
Team string `json:"team"`
|
Team string `json:"team"`
|
||||||
Role *RoleType `json:"role,omitempty"`
|
Role *RoleType `json:"role,omitempty"`
|
||||||
Permission PermissionType `json:"permission"`
|
Permission PermissionType `json:"permission"`
|
||||||
PermissionName string `json:"permissionName"`
|
PermissionName string `json:"permissionName"`
|
||||||
@@ -74,7 +74,7 @@ type SetDashboardAclCommand struct {
|
|||||||
DashboardId int64
|
DashboardId int64
|
||||||
OrgId int64
|
OrgId int64
|
||||||
UserId int64
|
UserId int64
|
||||||
TeamId int64
|
TeamId int64
|
||||||
Permission PermissionType
|
Permission PermissionType
|
||||||
|
|
||||||
Result DashboardAcl
|
Result DashboardAcl
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ type GetTeamByIdQuery struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type GetTeamsByUserQuery struct {
|
type GetTeamsByUserQuery struct {
|
||||||
UserId int64 `json:"userId"`
|
UserId int64 `json:"userId"`
|
||||||
Result []*Team `json:"teams"`
|
Result []*Team `json:"teams"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,8 +61,8 @@ type SearchTeamsQuery struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SearchTeamQueryResult struct {
|
type SearchTeamQueryResult struct {
|
||||||
TotalCount int64 `json:"totalCount"`
|
TotalCount int64 `json:"totalCount"`
|
||||||
Teams []*Team `json:"teams"`
|
Teams []*Team `json:"teams"`
|
||||||
Page int `json:"page"`
|
Page int `json:"page"`
|
||||||
PerPage int `json:"perPage"`
|
PerPage int `json:"perPage"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ var (
|
|||||||
|
|
||||||
// TeamMember model
|
// TeamMember model
|
||||||
type TeamMember struct {
|
type TeamMember struct {
|
||||||
Id int64
|
Id int64
|
||||||
OrgId int64
|
OrgId int64
|
||||||
TeamId int64
|
TeamId int64
|
||||||
UserId int64
|
UserId int64
|
||||||
|
|
||||||
Created time.Time
|
Created time.Time
|
||||||
Updated time.Time
|
Updated time.Time
|
||||||
@@ -25,13 +25,13 @@ type TeamMember struct {
|
|||||||
// COMMANDS
|
// COMMANDS
|
||||||
|
|
||||||
type AddTeamMemberCommand struct {
|
type AddTeamMemberCommand struct {
|
||||||
UserId int64 `json:"userId" binding:"Required"`
|
UserId int64 `json:"userId" binding:"Required"`
|
||||||
OrgId int64 `json:"-"`
|
OrgId int64 `json:"-"`
|
||||||
TeamId int64 `json:"-"`
|
TeamId int64 `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type RemoveTeamMemberCommand struct {
|
type RemoveTeamMemberCommand struct {
|
||||||
UserId int64
|
UserId int64
|
||||||
TeamId int64
|
TeamId int64
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,16 +40,16 @@ type RemoveTeamMemberCommand struct {
|
|||||||
|
|
||||||
type GetTeamMembersQuery struct {
|
type GetTeamMembersQuery struct {
|
||||||
TeamId int64
|
TeamId int64
|
||||||
Result []*TeamMemberDTO
|
Result []*TeamMemberDTO
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------
|
// ----------------------
|
||||||
// Projections and DTOs
|
// Projections and DTOs
|
||||||
|
|
||||||
type TeamMemberDTO struct {
|
type TeamMemberDTO struct {
|
||||||
OrgId int64 `json:"orgId"`
|
OrgId int64 `json:"orgId"`
|
||||||
TeamId int64 `json:"teamId"`
|
TeamId int64 `json:"teamId"`
|
||||||
UserId int64 `json:"userId"`
|
UserId int64 `json:"userId"`
|
||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
Login string `json:"login"`
|
Login string `json:"login"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ func SetDashboardAcl(cmd *m.SetDashboardAclCommand) error {
|
|||||||
|
|
||||||
entity := m.DashboardAcl{
|
entity := m.DashboardAcl{
|
||||||
OrgId: cmd.OrgId,
|
OrgId: cmd.OrgId,
|
||||||
TeamId: cmd.TeamId,
|
TeamId: cmd.TeamId,
|
||||||
UserId: cmd.UserId,
|
UserId: cmd.UserId,
|
||||||
Created: time.Now(),
|
Created: time.Now(),
|
||||||
Updated: time.Now(),
|
Updated: time.Now(),
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ func TestDashboardAclDataAccess(t *testing.T) {
|
|||||||
Convey("Should be able to add a user permission for a team", func() {
|
Convey("Should be able to add a user permission for a team", func() {
|
||||||
setDashAclCmd := m.SetDashboardAclCommand{
|
setDashAclCmd := m.SetDashboardAclCommand{
|
||||||
OrgId: 1,
|
OrgId: 1,
|
||||||
TeamId: group1.Result.Id,
|
TeamId: group1.Result.Id,
|
||||||
DashboardId: savedFolder.Id,
|
DashboardId: savedFolder.Id,
|
||||||
Permission: m.PERMISSION_EDIT,
|
Permission: m.PERMISSION_EDIT,
|
||||||
}
|
}
|
||||||
@@ -215,7 +215,7 @@ func TestDashboardAclDataAccess(t *testing.T) {
|
|||||||
Convey("Should be able to update an existing permission for a team", func() {
|
Convey("Should be able to update an existing permission for a team", func() {
|
||||||
err := SetDashboardAcl(&m.SetDashboardAclCommand{
|
err := SetDashboardAcl(&m.SetDashboardAclCommand{
|
||||||
OrgId: 1,
|
OrgId: 1,
|
||||||
TeamId: group1.Result.Id,
|
TeamId: group1.Result.Id,
|
||||||
DashboardId: savedFolder.Id,
|
DashboardId: savedFolder.Id,
|
||||||
Permission: m.PERMISSION_ADMIN,
|
Permission: m.PERMISSION_ADMIN,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -196,11 +196,11 @@ func AddTeamMember(cmd *m.AddTeamMemberCommand) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
entity := m.TeamMember{
|
entity := m.TeamMember{
|
||||||
OrgId: cmd.OrgId,
|
OrgId: cmd.OrgId,
|
||||||
TeamId: cmd.TeamId,
|
TeamId: cmd.TeamId,
|
||||||
UserId: cmd.UserId,
|
UserId: cmd.UserId,
|
||||||
Created: time.Now(),
|
Created: time.Now(),
|
||||||
Updated: time.Now(),
|
Updated: time.Now(),
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := sess.Insert(&entity)
|
_, err := sess.Insert(&entity)
|
||||||
|
|||||||
Reference in New Issue
Block a user